UNPKG

react-native-epson-escposprinter

Version:
41 lines 1.16 kB
/** * A queue implementation that allows for adding and removing elements, with optional waiting when * popping elements from an empty queue. * * ```ts * import { assertEquals } from "@std/assert"; * import { Queue } from "@core/asyncutil/queue"; * * const queue = new Queue<number>(); * queue.push(1); * queue.push(2); * queue.push(3); * assertEquals(await queue.pop(), 1); * assertEquals(await queue.pop(), 2); * assertEquals(await queue.pop(), 3); * ``` */ export declare class Queue<T extends NonNullable<unknown> | null> { #private; /** * Gets the number of items in the queue. */ get size(): number; /** * Returns true if the queue is currently locked. */ get locked(): boolean; /** * Adds an item to the end of the queue and notifies any waiting consumers. */ push(value: T): void; /** * Removes the next item from the queue, optionally waiting if the queue is currently empty. * * @returns A promise that resolves to the next item in the queue. */ pop({ signal }?: { signal?: AbortSignal; }): Promise<T>; } //# sourceMappingURL=Queue.d.ts.map