c15t
Version:
Headless JavaScript consent management platform for cookie banners, privacy preferences, consent storage, and script gating.
13 lines (12 loc) • 650 B
TypeScript
/**
* Returns the in-flight request for `key`, or starts and tracks a new one.
*
* Settled requests are removed only when they are still the request registered
* for the key, so an older request cannot delete a newer replacement.
*
* @param requests - In-flight requests indexed by their logical operation
* @param key - Stable identity for the operation
* @param createRequest - Starts the operation when no request is in flight
* @returns The existing or newly tracked request
*/
export declare function coalesceInFlight<Result>(requests: Map<string, Promise<Result>>, key: string, createRequest: () => Promise<Result>): Promise<Result>;