@push.rocks/lik
Version:
Provides a collection of lightweight helpers and utilities for Node.js projects.
24 lines (23 loc) • 707 B
TypeScript
import * as plugins from './classes.plugins.js';
export declare class BackpressuredArray<T> {
data: T[];
private highWaterMark;
hasSpace: plugins.smartrx.rxjs.Subject<"hasSpace">;
private itemsAvailable;
private isDestroyed;
constructor(highWaterMark?: number);
get length(): number;
push(item: T): boolean;
pushMany(items: T[]): boolean;
shift(): T | undefined;
peek(): T | undefined;
checkSpaceAvailable(): boolean;
checkHasItems(): boolean;
waitForSpace(): Promise<void>;
waitForItems(): Promise<void>;
[Symbol.iterator](): Iterator<T>;
/**
* destroys the BackpressuredArray, completing all subjects
*/
destroy(): void;
}