UNPKG

@sunney/flareutils

Version:

Small Utilities and little goodies that make developing with Cloudflare easier and faster.

18 lines (17 loc) 543 B
/** * A queue that runs a maximum of 6 promises at a time, to stay within Workers' concurrent I/O limit. */ export declare class PromiseQueue { private queue; constructor(); /** * Add a promise to the queue. Always await this function. * @param promise The promise to add to the queue. */ add(promise: Promise<unknown>): Promise<void>; /** * Flush the queue. Always await this function. * @note Run this function when all tasks have been added to the queue. */ flush(): Promise<void>; }