WaitQueue Class
Package: @esfx/async-waitqueue
An async coordination primitive that provides a queue of Promises.
Declaration
export declare class WaitQueue<T>
Properties
size
Gets the number of pending entries in the queue.
Declaration
get size(): number;
Property Value
Methods
cancelAll(reason)
Rejects all pending wait()
operations with a CancelError
.
Declaration
cancelAll(reason?: CancelError): number;
Parameters
- reason
- CancelError
Returns
The number of pending wait()
operations that were rejected.
cancelOne(reason)
Rejects the next pending wait()
operation with a CancelError
.
Declaration
cancelOne(reason?: CancelError): boolean;
Parameters
- reason
- CancelError
Returns
true
if a pending wait()
operation was rejected; otherwise, false
.
rejectAll(reason)
Rejects all pending wait()
operations with the provided reason.
Declaration
rejectAll(reason: unknown): number;
Parameters
- reason
- unknown
Returns
The number of pending wait()
operations that were rejected.
rejectOne(reason)
Rejects the next pending wait()
operation with the provided reason.
Declaration
rejectOne(reason: unknown): boolean;
Parameters
- reason
- unknown
Returns
true
if a pending wait()
operation was rejected; otherwise, false
.
resolveAll(this)
Resolves all pending wait()
operations with the provided value.
Declaration
resolveAll(this: WaitQueue<void>): number;
Parameters
- this
- WaitQueue<void>
Returns
The number of pending wait()
operations that were resolved.
resolveAll(value)
Resolves all pending wait()
operations with the provided value.
Declaration
resolveAll(value: T | PromiseLike<T>): number;
Parameters
- value
- T | PromiseLike<T>
Returns
The number of pending wait()
operations that were resolved.
resolveOne(this)
Resolves a pending wait()
operation with the provided value.
Declaration
resolveOne(this: WaitQueue<void>): boolean;
Parameters
- this
- WaitQueue<void>
Returns
true
if a pending wait()
operation was resolved; otherwise, false
.
resolveOne(value)
Resolves a pending wait()
operation with the provided value.
Declaration
resolveOne(value: T | PromiseLike<T>): boolean;
Parameters
- value
- T | PromiseLike<T>
Returns
true
if a pending wait()
operation was resolved; otherwise, false
.
wait(cancelable)
Returns a Promise
for the next value to be added to the queue.
Declaration
wait(cancelable?: Cancelable): Promise<T>;
Parameters
Returns