prex
Version:
Async coordination primitives and extensions on top of ES6 Promises
37 lines (35 loc) • 1.62 kB
TypeScript
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Licensed under the Apache License, Version 2.0.
See LICENSE file in the project root for details.
***************************************************************************** */
import { CancellationToken } from "./cancellation";
import { Cancelable } from "@esfx/cancelable";
/**
* Waits the specified number of milliseconds before resolving.
*
* @param msec The number of milliseconds to wait before resolving.
*/
export declare function delay(msec: number): Promise<void>;
/**
* Waits the specified number of milliseconds before resolving with the provided value.
*
* @param msec The number of milliseconds to wait before resolving.
* @param value An optional value for the resulting Promise.
*/
export declare function delay<T>(msec: number, value: T | PromiseLike<T>): Promise<T>;
/**
* Waits the specified number of milliseconds before resolving.
*
* @param token A CancellationToken
* @param msec The number of milliseconds to wait before resolving.
*/
export declare function delay(token: CancellationToken | Cancelable, msec: number): Promise<void>;
/**
* Waits the specified number of milliseconds before resolving with the provided value.
*
* @param token A CancellationToken
* @param msec The number of milliseconds to wait before resolving.
* @param value An optional value for the resulting Promise.
*/
export declare function delay<T>(token: CancellationToken | Cancelable, msec: number, value: T | PromiseLike<T>): Promise<T>;