UNPKG

@seriousme/opifex

Version:

MQTT client & server for Deno & NodeJS

28 lines 730 B
/** * An Async Queue is a queue that can be used to push items to it and then wait * for them to be consumed. * * @example * ```ts * const queue = new AsyncQueue<string>(); * queue.push("hello"); * for await (const item of queue) { * console.log(item); // "hello" * } * ``` */ export declare class AsyncQueue<T> { private queue; private maxQueueLength; private nextResolve; private nextReject; private done; private hasNext; constructor(maxQueueLength?: number); next(): Promise<T>; close(reason?: string): void; [Symbol.asyncIterator](): AsyncGenerator<Awaited<T>, void, unknown>; push(item: T): void; get isDone(): boolean; } //# sourceMappingURL=asyncQueue.d.ts.map