Skip to content

Commit f3aae81

Browse files
committed
refactor(es6) upgrade MultiWatching to ES6 class
1 parent f745f02 commit f3aae81

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

lib/MultiWatching.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
var async = require("async");
5+
"use strict";
66

7-
function MultiWatching(watchings) {
8-
this.watchings = watchings;
9-
}
7+
const async = require("async");
8+
9+
class MultiWatching {
10+
constructor(watchings) {
11+
this.watchings = watchings;
12+
}
1013

11-
MultiWatching.prototype.invalidate = function() {
12-
this.watchings.forEach(function(watching) {
13-
watching.invalidate();
14-
});
15-
};
14+
invalidate() {
15+
this.watchings.forEach((watching) => watching.invalidate());
16+
}
1617

17-
MultiWatching.prototype.close = function(callback) {
18-
async.forEach(this.watchings, function(watching, finishedCallback) {
19-
watching.close(finishedCallback);
20-
}, callback);
21-
};
18+
close(callback) {
19+
async.forEach(this.watchings, (watching, finishedCallback) => {
20+
watching.close(finishedCallback);
21+
}, callback);
22+
}
23+
}
2224

2325
module.exports = MultiWatching;

0 commit comments

Comments
 (0)