npm.io
1.0.3 • Published 2 years ago

@types/promise-inflight

Licence
MIT
Version
1.0.3
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/promise-inflight

Summary

This package contains type definitions for promise-inflight (https://github.com/iarna/promise-inflight#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-inflight.

index.d.ts

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>;
    };
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 0939 GMT
  • Dependencies: none

Credits

These definitions were written by Emily Marigold Klassen.