Initial reference to this handle.
Filesystem path to be watched.
Watcher-specific options
Logging and parcel watcher options
The client to forward events to.
Amount of time in ms to wait once this handle is not referenced anymore.
Protected
debugUsed for debugging to keep track of the watchers.
Protected
Readonly
deferredThis deferred only rejects with WatcherDisposal
and never resolves.
Protected
Readonly
deferredAmount of time in ms to wait once this handle is not referenced anymore.
Protected
deferredWhen the ref count hits zero, we schedule this watch handle to be disposed.
Protected
disposedProtected
Readonly
fileThe client to forward events to.
Readonly
fsFilesystem path to be watched.
Protected
parcelEnsures that events are processed in the order they are emitted, despite being processed async.
Protected
Readonly
parcelLogging and parcel watcher options
Protected
Readonly
refsWe count each reference made to this watcher, per client.
We do this to know where to send events via the network.
An entry should be removed when its value hits zero.
Protected
watcherWhen this field is set, it means the watcher instance was successfully started.
Readonly
watcherWatcher-specific options
Readonly
whenResolves once this handle disposed itself and its resources. Never throws.
Readonly
whenPromise that resolves when the watcher is fully started, or got disposed.
Will reject if an error occurred while starting.
Protected
Static
debugProtected
_Internal disposal mechanism.
Protected
assertwith WatcherDisposal if this instance is disposed.
Protected
createProtected
debugeslint-disable-next-line @typescript-eslint/no-explicit-any
Protected
fireAll clients with at least one active reference.
Add the references for each client together.
Protected
handleProtected
infoeslint-disable-next-line @typescript-eslint/no-explicit-any
Protected
isReturns true if at least one client listens to this handle.
Protected
onWhen references hit zero, we'll schedule disposal for a bit later.
This allows new references to reuse this watcher instead of creating a new one.
e.g. A frontend disconnects for a few milliseconds before reconnecting again.
Protected
onIf we get new references after hitting zero, let's unschedule our disposal and keep watching.
Protected
pushProtected
resolveProtected
startWhen starting a watcher, we'll first check and wait for the path to exists before running a parcel watcher.
Protected
stopGiven a started parcel watcher instance, gracefully shut it down.
Because URIs can be watched by different clients, we'll track how many are listening for a given URI.
This component wraps the whole start/stop process given some reference count.
Once there are no more references the handle will wait for some time before destroying its resources.