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.

Constructors

Properties

debugId: number = ...

Used for debugging to keep track of the watchers.

deferredDisposalDeferred: Deferred<never> = ...

This deferred only rejects with WatcherDisposal and never resolves.

deferredDisposalTimeout: number = 10_000

Amount of time in ms to wait once this handle is not referenced anymore.

deferredDisposalTimer: undefined | Timeout

When the ref count hits zero, we schedule this watch handle to be disposed.

disposed: boolean = false
fileSystemWatcherClient: FileSystemWatcherServiceClient

The client to forward events to.

fsPath: string

Filesystem path to be watched.

parcelEventProcessingQueue: Promise<void> = ...

Ensures that events are processed in the order they are emitted, despite being processed async.

parcelFileSystemWatchServerOptions: ParcelFileSystemWatcherServerOptions

Logging and parcel watcher options

refsPerClient: Map<number, {
    value: number;
}> = ...

We 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.

Type declaration

  • value: number
watcher: undefined | AsyncSubscription

When this field is set, it means the watcher instance was successfully started.

watcherOptions: ParcelWatcherOptions

Watcher-specific options

whenDisposed: Promise<void> = ...

Resolves once this handle disposed itself and its resources. Never throws.

whenStarted: Promise<boolean>

Promise that resolves when the watcher is fully started, or got disposed.

Will reject if an error occurred while starting.

Returns

true if successfully started, false if disposed early.

debugIdSequence: number = 0

Methods