UNPKG

1.02 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = void 0;
7
8function _events() {
9 const data = require('events');
10
11 _events = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _defineProperty(obj, key, value) {
19 if (key in obj) {
20 Object.defineProperty(obj, key, {
21 value: value,
22 enumerable: true,
23 configurable: true,
24 writable: true
25 });
26 } else {
27 obj[key] = value;
28 }
29 return obj;
30}
31
32class TestWatcher extends _events().EventEmitter {
33 constructor({isWatchMode}) {
34 super();
35
36 _defineProperty(this, 'state', void 0);
37
38 _defineProperty(this, '_isWatchMode', void 0);
39
40 this.state = {
41 interrupted: false
42 };
43 this._isWatchMode = isWatchMode;
44 }
45
46 setState(state) {
47 Object.assign(this.state, state);
48 this.emit('change', this.state);
49 }
50
51 isInterrupted() {
52 return this.state.interrupted;
53 }
54
55 isWatchMode() {
56 return this._isWatchMode;
57 }
58}
59
60exports.default = TestWatcher;