@launchdarkly/js-sdk-common
Version:
LaunchDarkly SDK for JavaScript - common code
20 lines • 710 B
TypeScript
import { VoidFunction } from './VoidFunction';
/**
* Represents a timeout that can be cancelled.
*
* When racing a timeout, and another task completes before the timeout,
* then the timeout should be cancelled. This prevents leaving open handles
* which can stop the runtime from exiting.
*/
export interface CancelableTimeout {
promise: Promise<void>;
cancel: VoidFunction;
}
/**
* Returns a promise which errors after t seconds.
*
* @param t Timeout in seconds.
* @param taskName Name of task being timed for logging and error reporting.
*/
export declare function cancelableTimedPromise(t: number, taskName: string): CancelableTimeout;
//# sourceMappingURL=cancelableTimedPromise.d.ts.map