matrix-react-sdk
Version:
SDK for matrix.org using React
10 lines (9 loc) • 614 B
TypeScript
export declare function timeout<T, Y>(promise: Promise<T>, timeoutValue: Y, ms: number): Promise<T | Y>;
export declare function retry<T, E extends Error>(fn: () => Promise<T>, num: number, predicate?: (e: E) => boolean): Promise<T>;
/**
* Batch promises into groups of a given size.
* Execute the promises in parallel, but wait for all promises in a batch to resolve before moving to the next batch.
* @param funcs - The promises to batch
* @param batchSize - The number of promises to execute in parallel
*/
export declare function batch<T>(funcs: Array<() => Promise<T>>, batchSize: number): Promise<T[]>;