@typespec/http-server-js
Version:
TypeSpec HTTP server code generator for JavaScript
24 lines • 600 B
TypeScript
/**
* A deduplicating queue that only allows elements to be enqueued once.
*
* This uses a Set to track visited elements.
*/
export interface OnceQueue<T> {
/**
* Enqueue a value if it has not been enqueued before.
*/
add(value: T): void;
/**
* Dequeue the next value.
*/
take(): T | undefined;
/**
* Check if the queue is empty.
*/
isEmpty(): boolean;
}
/**
* Creates a new OnceQueue with the given initial values.
*/
export declare function createOnceQueue<T>(...initialValues: T[]): OnceQueue<T>;
//# sourceMappingURL=once-queue.d.ts.map