parallel-universe
Version:
The set of async flow control structures and promise utils.
19 lines (18 loc) • 855 B
TypeScript
import { AbortablePromise } from './AbortablePromise';
import { Awaitable } from './types';
/**
* Returns a promise that is fulfilled with `undefined` after a timeout elapses.
*
* @param ms The timeout in milliseconds after which the returned promise is fulfilled.
* @returns The promise that is fulfilled after a timeout.
*/
export declare function delay(ms: number): AbortablePromise<void>;
/**
* Returns a promise that is fulfilled with a value after a timeout elapses.
*
* @param ms The timeout in milliseconds after which the returned promise is fulfilled.
* @param value The value to fulfill the promise with.
* @returns The promise that is fulfilled with the value after the timeout elapses.
* @template T The value to fulfill the promise with.
*/
export declare function delay<T>(ms: number, value: Awaitable<T>): AbortablePromise<T>;