lerna
Version:
Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository
34 lines (33 loc) • 1.1 kB
TypeScript
/**
* A queue abstraction for tasks that may require a delayed execution
*/
export interface Queue {
/**
* Run a task once the queue is cleared
* @param f A function that will be executed once the queue is useable
* @return A promise that wraps the value returned by f
*/
queue<T>(f: () => Promise<T>): Promise<T>;
}
/**
* A sized queue that adds a delay between the end of an item's execution.
*
* Use only with async code, multi-threading is not supported.
*/
export declare class TailHeadQueue implements Queue {
private queue_list;
private queue_size;
private queue_period;
private allowance;
private last_end;
/**
* @param size The number of items that may run concurrently
* @param period The time between the end of the execution of an item and the start of the execution of the next one (ms)
*/
constructor(size: any, period: any);
/**
* Validate the execution of a queue item and schedule the execution of the next one
*/
_on_settled(): void;
queue<T>(f: () => Promise<T>): Promise<T>;
}