UNPKG

async-monitor

Version:

Provides a mechanism that synchronizes access to objects.

22 lines (21 loc) 634 B
export declare class SingleChannel<T> { private hasValue; private value; constructor(hasValue: boolean, value: T | null); acquire(abortSignal?: AbortSignal | null): Promise<T>; private assertClosed; close(reason?: unknown): void; getValue(): [false] | [true, T]; private removeValue; setValue(value: T): void; get isClosed(): boolean; private _isClosed; private acquireCount; private lock; } export declare class SingleChannelError extends Error { } export declare class ExistValueError extends SingleChannelError { } export declare class ClosedError extends SingleChannelError { }