How to use the watch.unwatchTree function in watch

To help you get started, we’ve selected a few watch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hangxingliu / mdjs.editor / build.js View on Github external
function watch() {
	console.log(`  watching source folder...`);
	watcher.unwatchTree(from);
	watcher.watchTree(from, { interval: 0.5 }, function (f, curr, prev) {
		console.log(' building...');
		if (typeof f == "object" && prev === null && curr === null) {
			// 首次扫描
			main();
		} else {
			main(true);
		}
	});
}
github download-online-video / chrome-avgle-helper / build / build.js View on Github external
async function taskWatch() {
		const watchDir = path.join(projectRoot, config.watch);
		const watchName = path.relative(process.cwd(), watchDir);
		watch.unwatchTree(watchDir);
		watch.watchTree(watchDir, { interval: 0.5 }, function (p, curr, prev) {
			if (typeof p == "object" && prev === null && curr === null)
				return log.start(`watching "${watchName}"`); //First time scan
			const file = String(p);
			const fileName = path.relative(process.cwd(), file);
			log.info(`"${fileName}" is modified`);
			if (assetEntrypoints.has(file))
				return taskCopyAssets(file).catch(onFatal);
			if (file.endsWith('.css') || file.endsWith('.scss') || file.endsWith('.sass'))
				return taskBuildStylesheets(stylesheetEntrypoints.has(file) ? file : '').catch(onFatal);
		});
	}
} // end of main function
github monaca / monaca-lib / src / localkit / fileWatcher.js View on Github external
FileWatcher.prototype.stop = function() {
    if (this.filePath) {
      watch.unwatchTree(this.filePath);
      this.filePath = null;
      this._isRunning = false;
    }
  };
github guananddu / fis3-wrapper-common / lib / cleaner.js View on Github external
global.watchesTree.map( function ( el ) {
        watch.unwatchTree( el );
    } );
github experimentalDataAesthetics / play-splom / app / sound / SoundApp.js View on Github external
unwatchDir() {
    if (this.watchingDirectory) {
      watch.unwatchTree(this.watchingDirectory);
    }
  }
}
github antiboredom / servi-ide / app / filetree.js View on Github external
FileTree.prototype.pauseWatch = function() {
  watch.unwatchTree(this.path);
  this.watching = false;
};

watch

Utilities for watching file trees.

Apache-2.0
Latest version published 7 years ago

Package Health Score

65 / 100
Full package analysis