0.6.1
fix: catch and warn if remove watcher is called but no watcher was started.master
parent
3d036ac7a0
commit
f903ef7071
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@uci-utils/watcher",
|
"name": "@uci-utils/watcher",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"description": "File System Watcher Class that emits events",
|
"description": "File System Watcher Class that emits events",
|
||||||
"main": "src/watcher.js",
|
"main": "src/watcher.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
@ -102,9 +102,11 @@ class Watcher extends Emitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
remove() {
|
remove() {
|
||||||
|
if (this._watcher) {
|
||||||
this.stop()
|
this.stop()
|
||||||
this._watcher.removeAllListeners()
|
this._watcher.removeAllListeners()
|
||||||
delete (this._watcher)
|
delete (this._watcher)
|
||||||
|
} else log.warn('no watcher started nothing to remove')
|
||||||
this._ready = false
|
this._ready = false
|
||||||
this.emit('ready', false)
|
this.emit('ready', false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue