Projekt

Obecné

Profil

Stáhnout (886 Bajtů) Statistiky
| Větev: | Revize:
1
/*
2
	MIT License http://www.opensource.org/licenses/mit-license.php
3
	Author Tobias Koppers @sokra
4
*/
5
"use strict";
6

    
7
const asyncLib = require("neo-async");
8

    
9
class MultiWatching {
10
	constructor(watchings, compiler) {
11
		this.watchings = watchings;
12
		this.compiler = compiler;
13
	}
14

    
15
	invalidate() {
16
		for (const watching of this.watchings) {
17
			watching.invalidate();
18
		}
19
	}
20

    
21
	suspend() {
22
		for (const watching of this.watchings) {
23
			watching.suspend();
24
		}
25
	}
26

    
27
	resume() {
28
		for (const watching of this.watchings) {
29
			watching.resume();
30
		}
31
	}
32

    
33
	close(callback) {
34
		asyncLib.forEach(
35
			this.watchings,
36
			(watching, finishedCallback) => {
37
				watching.close(finishedCallback);
38
			},
39
			err => {
40
				this.compiler.hooks.watchClose.call();
41
				if (typeof callback === "function") {
42
					this.compiler.running = false;
43
					callback(err);
44
				}
45
			}
46
		);
47
	}
48
}
49

    
50
module.exports = MultiWatching;
(94-94/144)