File: index.d.ts

package info (click to toggle)
node-promise-inflight 1.0.1%2B~1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 104 kB
  • sloc: javascript: 33; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Type definitions for promise-inflight 1.0
// Project: https://github.com/iarna/promise-inflight#readme
// Definitions by: Emily Marigold Klassen <https://github.com/forivall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export = inflight;

type Resolvable<T> = PromiseLike<T> | T;
/**
 * @param unique A globally-unique key that is used to identify the call to this
 * function. It determines how to cache the inlfight request. eg. a url or
 * filename or whatever.
 * @param doFly The function that actually carries out the request, eg. fetches
 * the url or whatever.
 * @returns One promise as long as the `doFly()` promise is pending. Note that
 * if `bluebird` is installed, this promise will be a Bluebird promise.
 */
declare function inflight<T>(
    unique: Resolvable<string> | Resolvable<ReadonlyArray<Resolvable<string>>>,
    doFly: () => Resolvable<T>
): Promise<T>;

declare namespace inflight {
    const active: {
        [key: string]: Promise<any>
    };
}