gulp.task('watch', (done) => { // Watch LESS files and generate CSS watch(['public/stylesheets/less/**/*.less'], async () => { lessCss(); console.log(colors.blue('CSS generation complete')); }); // run, watch and restart app nodemon(nodemonOptions) .once('quit', () => { done(); }); });
function UnreadClassHook (anchor, msgId) { return function (element) { return watch(anchor, (current) => { if (current && current.unread && current.unread.includes(msgId)) { element.classList.add('-unread') } else { element.classList.remove('-unread') } }) } }
agent.messenger.on('agent-watch', function() { agent.watcher.watch([file_path1, dir_path], listener); agent.messenger.broadcast('agent-watch-success', 'agent watch success'); });
yargs .command( '$0 <dest>', 'default command', yargs => { yargs.boolean('run-once').boolean('quiet'); }, argv => { const source = path.resolve(__dirname, '..', 'packages'); const dest = path.resolve(process.cwd(), argv.dest); watch(source, dest, argv); } ) .help()
export function initState(vm) { vm._watchers = [] const opts = vm.$options if (opts.props) initProps(vm, opts.props) if (opts.methods) initMethods(vm, opts.methods) if (opts.data) { initData(vm) } else { observe(vm._data = {}, true /* asRootData */ ) } if (opts.computed) initComputed(vm, opts.computed) if (opts.watch && opts.watch !== nativeWatch) { initWatch(vm, opts.watch) } }
function start(){ build(); if (watchMode) { watch(); } }
watch(pendingCount, count => { electron.remote.app.badgeCount = count })
async createPages ({ slugify, createPage, removePagesByComponent }) { const files = await glob('**/*.vue', { cwd: this.pagesDir }) for (const file of files) { createPage(this.createPageOptions(file, slugify)) } if (process.env.NODE_ENV === 'development') { const watcher = chokidar.watch('**/*.vue', { ignoreInitial: true, cwd: this.pagesDir }) watcher.on('add', file => { createPage(this.createPageOptions(slash(file), slugify)) }) watcher.on('unlink', file => { removePagesByComponent(path.join(this.pagesDir, slash(file))) }) } }
/// The browser sync prototyping gulp.task('bsync', () => { // Syncs browser browserSync.init({ server: { baseDir: './' }, open: true, startPath: "./test/html/test-all.html", // Makes it easier to test on external mobile devices host: "0.0.0.0", tunnel: true }); // Detect change -> rebuild TS gulp.watch(['src/**.js'], gulp.series('minify')); });
app.get('/app-watch', function*() { app.watcher.watch([file_path1, dir_path], callback); this.body = 'app watch success'; });
fs.watch(dir, () => { this._runNextTick = true; })
fs.watch(dir, () => { this._runNextTick = true; })
async createPages ({ slugify, createPage, removePagesByComponent }) { const files = await glob('**/*.vue', { cwd: this.pagesDir }) for (const file of files) { createPage(this.createPageOptions(file, slugify)) } if (process.env.NODE_ENV === 'development') { const watcher = chokidar.watch('**/*.vue', { ignoreInitial: true, cwd: this.pagesDir }) watcher.on('add', file => { createPage(this.createPageOptions(slash(file), slugify)) }) watcher.on('unlink', file => { removePagesByComponent(path.join(this.pagesDir, slash(file))) }) } }