mirror of https://github.com/webpack/webpack.git
refactor(es6) upgrade MultiWatching to ES6 class
This commit is contained in:
parent
f745f02910
commit
f3aae8184e
|
|
@ -2,22 +2,24 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var async = require("async");
|
||||
"use strict";
|
||||
|
||||
function MultiWatching(watchings) {
|
||||
this.watchings = watchings;
|
||||
const async = require("async");
|
||||
|
||||
class MultiWatching {
|
||||
constructor(watchings) {
|
||||
this.watchings = watchings;
|
||||
}
|
||||
|
||||
invalidate() {
|
||||
this.watchings.forEach((watching) => watching.invalidate());
|
||||
}
|
||||
|
||||
close(callback) {
|
||||
async.forEach(this.watchings, (watching, finishedCallback) => {
|
||||
watching.close(finishedCallback);
|
||||
}, callback);
|
||||
}
|
||||
}
|
||||
|
||||
MultiWatching.prototype.invalidate = function() {
|
||||
this.watchings.forEach(function(watching) {
|
||||
watching.invalidate();
|
||||
});
|
||||
};
|
||||
|
||||
MultiWatching.prototype.close = function(callback) {
|
||||
async.forEach(this.watchings, function(watching, finishedCallback) {
|
||||
watching.close(finishedCallback);
|
||||
}, callback);
|
||||
};
|
||||
|
||||
module.exports = MultiWatching;
|
||||
|
|
|
|||
Loading…
Reference in New Issue