diff --git a/lib/file-list.js b/lib/file-list.js index b512caf8b..8e280ac74 100644 --- a/lib/file-list.js +++ b/lib/file-list.js @@ -73,9 +73,15 @@ var List = function (patterns, excludes, emitter, preprocess, batchInterval) { // Emit the `file_list_modified` event. // This function is throttled to the value of `batchInterval` // to avoid spamming the listener. - this._emitModified = _.throttle(function () { - self._emitter.emit('file_list_modified', self.files) - }, this._batchInterval) + this._emitModified = function() { + // first time, it will emit immediately. + self._emitter.emit('file_list_modified', self.files); + + // in future, it will only emit once in every _batchInterval + self._emitModified = _.throttle(function () { + self._emitter.emit('file_list_modified', self.files) + }, self._batchInterval, {leading: false}); + } } // Private Interface