diff --git a/lib/monitor/watch.js b/lib/monitor/watch.js index 6e3e77f4..549bbf97 100644 --- a/lib/monitor/watch.js +++ b/lib/monitor/watch.js @@ -12,7 +12,6 @@ var utils = require('../utils'); var bus = utils.bus; var match = require('./match'); var watchers = []; -var ready = false; var debouncedBus; bus.on('reset', resetWatchers); @@ -23,7 +22,6 @@ function resetWatchers() { watcher.close(); }); watchers = []; - ready = false; } @@ -57,11 +55,13 @@ function watch() { usePolling: config.options.legacyWatch || false, }); + watcher.ready = false; + var total = 0; watcher.on('change', filterAndRestart); watcher.on('add', function (file) { - if (ready) { + if (watcher.ready) { return filterAndRestart(file); } @@ -70,7 +70,7 @@ function watch() { debug('watching dir: %s', file); }); watcher.on('ready', function () { - ready = true; + watcher.ready = true; resolve(total); debugRoot('watch is complete'); });