Initial reference to this handle.
since 1.77.0 - pass undefined and use addRequest; references follow requests.
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 ReadonlydeferredAmount of time in ms to wait once this handle is not referenced anymore.
ProtecteddeferredWhen the ref count hits zero, we schedule this watch handle to be disposed.
Protected ReadonlyfileThe client to forward events to.
ReadonlyfsFilesystem path to be watched.
ProtectedparcelEnsures that events are processed in the order they are emitted, despite being processed async.
Protected ReadonlyparcelLogging and parcel watcher options
Protected ReadonlyrefsWe 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 ReadonlytargetPath this watcher was asked about; the subclass decides what it resolves to.
ProtectedwatcherWhen this field is set, it means the watcher instance was successfully started.
ReadonlywatcherWatcher-specific options
ReadonlywhenResolves once this watcher disposed itself. Never rejects.
ReadonlywhenPromise that resolves when the watcher is fully started, or got disposed.
Will reject if an error occurred while starting.
A disposed watcher released its resources and must not be given further requests.
Protected_Internal disposal mechanism.
Serves request until removeRequest is called with the same watcherId.
Protectedassertwith WatcherDisposal if this instance is disposed.
ProtectedcreateProtecteddebugProtectederrorLogs as-is. Unlike info it is not prefixed, since these messages name their own path.
ProtectedfireAll clients with at least one active reference.
Add the references for each client together.
ProtectedhandleProtectedinfoProtectedisReturns true if at least one client listens to this handle.
ProtectedmarkMarks this watcher disposed.
false if it already was, in which case the caller must not clean up again.
ProtectedonWhen 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.
ProtectedonIf we get new references after hitting zero, let's unschedule our disposal and keep watching.
ProtectedpushReleases a request. The watcher disposes itself once it has none left.
ProtectedresolveProtectedstartWhen starting a watcher, we'll first check and wait for the path to exists before running a parcel watcher.
ProtectedstopGiven 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.