source: imaps-frontend/node_modules/p-limit/index.d.ts

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.4 KB
Line 
1declare namespace pLimit {
2 interface Limit {
3 /**
4 The number of promises that are currently running.
5 */
6 readonly activeCount: number;
7
8 /**
9 The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
10 */
11 readonly pendingCount: number;
12
13 /**
14 Discard pending promises that are waiting to run.
15
16 This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
17
18 Note: This does not cancel promises that are already running.
19 */
20 clearQueue: () => void;
21
22 /**
23 @param fn - Promise-returning/async function.
24 @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions.
25 @returns The promise returned by calling `fn(...arguments)`.
26 */
27 <Arguments extends unknown[], ReturnType>(
28 fn: (...arguments: Arguments) => PromiseLike<ReturnType> | ReturnType,
29 ...arguments: Arguments
30 ): Promise<ReturnType>;
31 }
32}
33
34/**
35Run multiple promise-returning & async functions with limited concurrency.
36
37@param concurrency - Concurrency limit. Minimum: `1`.
38@returns A `limit` function.
39*/
40declare function pLimit(concurrency: number): pLimit.Limit;
41
42export = pLimit;
Note: See TracBrowser for help on using the repository browser.