UNPKG

1.62 kBTypeScriptView Raw
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation.
3Licensed under the Apache License, Version 2.0.
4
5See LICENSE file in the project root for details.
6***************************************************************************** */
7import { CancellationToken } from "./cancellation";
8import { Cancelable } from "@esfx/cancelable";
9/**
10 * Waits the specified number of milliseconds before resolving.
11 *
12 * @param msec The number of milliseconds to wait before resolving.
13 */
14export declare function delay(msec: number): Promise<void>;
15/**
16 * Waits the specified number of milliseconds before resolving with the provided value.
17 *
18 * @param msec The number of milliseconds to wait before resolving.
19 * @param value An optional value for the resulting Promise.
20 */
21export declare function delay<T>(msec: number, value: T | PromiseLike<T>): Promise<T>;
22/**
23 * Waits the specified number of milliseconds before resolving.
24 *
25 * @param token A CancellationToken
26 * @param msec The number of milliseconds to wait before resolving.
27 */
28export declare function delay(token: CancellationToken | Cancelable, msec: number): Promise<void>;
29/**
30 * Waits the specified number of milliseconds before resolving with the provided value.
31 *
32 * @param token A CancellationToken
33 * @param msec The number of milliseconds to wait before resolving.
34 * @param value An optional value for the resulting Promise.
35 */
36export declare function delay<T>(token: CancellationToken | Cancelable, msec: number, value: T | PromiseLike<T>): Promise<T>;