/** * Repeatedly calls the given callback for a new Promise, until the provided `stop()` callback is called. * Waits to generate each Promise so that only a specified amount run concurrently. * * The entire Pool can be awaited, and will resolve once the feeder function calls `stop()`, and all pending promises finish. * * Note that if the feeder function is itself async, it may be called more than once after `stop` is triggered. * * @param feeder The function that should create and return new Promises. Call the provided `stop()` function to stop the pool. * @param concurrent Amount of Promises to run concurrently. * @param errHandler A callback to receive any otherwise uncaught errors. Defaults to logging. */ export default function promisePool(feeder: (stop: () => void, threadNumber: number) => Promise | null, concurrent: number, errHandler?: (err: any) => void): Promise; /** * Returns the given function, but wrapped so that only one call may run concurrently. */ export declare function mutex(fn: (...args: A) => T): (...args: A) => Promise; /** * Simple sleep function, just to save the trouble of retyping it. */ export declare function sleep(ms: number): Promise;