How to use the createMonitor function from watch
Find comprehensive JavaScript watch.createMonitor code examples handpicked from public code repositorys.
GitHub: wavesjs/waves-audio

95 96 97 98 99 100 101 102 103 104
* Watch javascript source files. */ function watchFiles(srcDirectory, distDirectory) { var transpiler = javascripts.getTranspiler(srcDirectory, distDirectory, isAllowed, babelOptions, browserifyOptions); watch.createMonitor(srcDirectory, watchOptions, function(monitor) { monitor.on('created', function(filename, stats) { if (isAllowed(filename)) transpiler.transpile(filename, []); });
GitHub: zotero/zotero-api-node

2 3 4 5 6 7 8 9 10 11
var watch = require('watch'); var debug = require('debug')('zotero:watch'); var exec = require('child_process').exec; ['lib', 'test'].forEach(function (dir) { watch.createMonitor(dir, function (monitor) { monitor.on('changed', changed); }); debug('watching %s directory', dir);
GitHub: rssilva/presentations
13 14 15 16 17 18 19 20 21 22 23 24 25
}) function startWatch () { var counter = 0 watch.createMonitor('app/', function (monitor) { console.log('watch is watching YOU, app/') monitor.on('changed', function () { console.log('changed')
GitHub: garbados/cbox

49 50 51 52 53 54 55 56 57 58
}); } function watch () { // TODO exit condition watcher.createMonitor(mount, { ignoreDotFiles: true }, function (monitor) { monitor.on('created', update); monitor.on('changed', update);
GitHub: popomore/node-debug

38 39 40 41 42 43 44 45 46 47
}); debugServer.start(config); } function createMonitor(cb) { watch.createMonitor(process.cwd(), { ignoreDotFiles: true, interval: 1000 }, function(monitor) { monitor.on('created', cb);
GitHub: bjoerge/quickreload

71 72 73 74 75 76 77 78 79
ignoreDotFiles: true, interval: options.interval, filter: filter } watch.createMonitor(rootDir, monitorOptions, function (monitor) { monitor.on('created', handleChange) monitor.on('changed', handleChange) monitor.on('removed', handleChange)
28 29 30 31 32 33 34 35 36 37
} searchOps = paramPathSearchOps(folderPath, searchOps) var loader = monitorLoader(folderPath, outPath, searchOps) watch.createMonitor((folderPath||'.'), watchOptions, loader) } /** f - file to write
34 35 36 37 38 39 40 41 42 43
opts = common.assignOptions(this, opts); this.watched = Object.create(null); this.root = path.resolve(dir); watch.createMonitor( this.root, { interval: opts.interval || DEFAULT_DELAY, filter: this.filter.bind(this),
19 20 21 22 23 24 25 26 27 28
const filesPath = path.join(context, file) const newFiles = glob.sync(filesPath) this.watchedFiles = this.watchedFiles.concat(newFiles) }) watch.createMonitor(context, (monitor) => { monitor.on("changed", _.debounce(onChange.bind(this), 500)) monitor.on("created", _.debounce((file) => { updateMonitor(file, 'created', monitor) }, 500)) monitor.on("removed", (file) => { updateMonitor(file, 'removed', monitor) })
1 2 3 4 5 6 7 8 9 10
import {Actions} from './actions'; // Initialize watcher. var watch = require('watch'); export function startWatch(){ watch.createMonitor('./root', function (monitor) { monitor.files['./root/*'] // Stat object for my zshrc. monitor.on("created", function (f, stat) { // Handle new files console.log(f, " created");
GitHub: sartaj/ob-scene

41 42 43 44 45 46 47 48 49 50
// Init function init() { console.log(colors.success(`compiling ${processedPath} \nto ${process.cwd()}/scenes-compiled.js`)) watch.createMonitor(processedPath, watchOpts, (monitor) => { monitor.on('created', (f) => { console.log(colors.data(`created ${f}`)) // Handle new files compile()
watch.createMonitor is the most popular function in watch (23 examples)