Skip to content

Commit

Permalink
Merge pull request #3103 from kutyel/master
Browse files Browse the repository at this point in the history
Add callback to Watching.prototype.invalidate
  • Loading branch information
sokra committed Jul 12, 2017
2 parents d005990 + 43f967c commit 95c7fa4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Compiler.js
Expand Up @@ -19,6 +19,7 @@ class Watching {
this.startTime = null;
this.invalid = false;
this.handler = handler;
this.callbacks = [];
this.closed = false;
if(typeof watchOptions === "number") {
this.watchOptions = {
Expand Down Expand Up @@ -105,6 +106,8 @@ class Watching {
if(!this.closed) {
this.watch(compilation.fileDependencies, compilation.contextDependencies, compilation.missingDependencies);
}
this.callbacks.forEach(cb => cb());
this.callbacks.length = 0;
}

watch(files, dirs, missing) {
Expand All @@ -122,7 +125,10 @@ class Watching {
});
}

invalidate() {
invalidate(callback) {
if(callback) {
this.callbacks.push(callback);
}
if(this.watcher) {
this.pausedWatcher = this.watcher;
this.watcher.pause();
Expand Down

0 comments on commit 95c7fa4

Please sign in to comment.