* Creates an instance of Watching. * @param {Compiler} compiler the compiler * @param {WatchOptions} watchOptions options * @param {Callback<Stats>} handler completion handler
(compiler, watchOptions, handler)
| 33 | * @param {Callback<Stats>} handler completion handler |
| 34 | */ |
| 35 | constructor(compiler, watchOptions, handler) { |
| 36 | /** @type {null | number} */ |
| 37 | this.startTime = null; |
| 38 | /** @type {boolean} */ |
| 39 | this.invalid = false; |
| 40 | /** @type {Callback<Stats>} */ |
| 41 | this.handler = handler; |
| 42 | /** @type {ErrorCallback[]} */ |
| 43 | this.callbacks = []; |
| 44 | /** @type {ErrorCallback[] | undefined} */ |
| 45 | this._closeCallbacks = undefined; |
| 46 | /** @type {boolean} */ |
| 47 | this.closed = false; |
| 48 | /** @type {boolean} */ |
| 49 | this.suspended = false; |
| 50 | /** @type {boolean} */ |
| 51 | this.blocked = false; |
| 52 | this._isBlocked = () => false; |
| 53 | this._onChange = () => {}; |
| 54 | this._onInvalid = () => {}; |
| 55 | if (typeof watchOptions === "number") { |
| 56 | /** @type {WatchOptions} */ |
| 57 | this.watchOptions = { |
| 58 | aggregateTimeout: watchOptions |
| 59 | }; |
| 60 | } else if (watchOptions && typeof watchOptions === "object") { |
| 61 | /** @type {WatchOptions} */ |
| 62 | this.watchOptions = { ...watchOptions }; |
| 63 | } else { |
| 64 | /** @type {WatchOptions} */ |
| 65 | this.watchOptions = {}; |
| 66 | } |
| 67 | if (typeof this.watchOptions.aggregateTimeout !== "number") { |
| 68 | this.watchOptions.aggregateTimeout = 20; |
| 69 | } |
| 70 | /** @type {Compiler} */ |
| 71 | this.compiler = compiler; |
| 72 | /** @type {boolean} */ |
| 73 | this.running = false; |
| 74 | /** @type {boolean} */ |
| 75 | this._initial = true; |
| 76 | /** @type {boolean} */ |
| 77 | this._invalidReported = true; |
| 78 | /** @type {boolean} */ |
| 79 | this._needRecords = true; |
| 80 | /** @type {undefined | null | Watcher} */ |
| 81 | this.watcher = undefined; |
| 82 | /** @type {undefined | null | Watcher} */ |
| 83 | this.pausedWatcher = undefined; |
| 84 | /** @type {CollectedFiles | undefined} */ |
| 85 | this._collectedChangedFiles = undefined; |
| 86 | /** @type {CollectedFiles | undefined} */ |
| 87 | this._collectedRemovedFiles = undefined; |
| 88 | this._done = this._done.bind(this); |
| 89 | process.nextTick(() => { |
| 90 | if (this._initial) this._invalidate(); |
| 91 | }); |
| 92 | } |
nothing calls this directly
no test coverage detected