prex-es5
Version:
Async coordination primitives and extensions on top of ES6 Promises
35 lines (33 loc) • 947 B
TypeScript
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Licensed under the Apache License, Version 2.0.
See LICENSE file in the project root for details.
***************************************************************************** */
/**
* Encapsulates a Promise and exposes its resolve and reject callbacks.
*/
export declare class Deferred<T> {
private _promise;
private _resolve;
private _reject;
/**
* Initializes a new instance of the Deferred class.
*/
constructor();
/**
* Gets the promise.
*/
readonly promise: Promise<T>;
/**
* Resolves the promise.
*
* @param value The value used to resolve the promise.
*/
resolve(value?: PromiseLike<T> | T): void;
/**
* Rejects the promise.
*
* @param reason The reason the promise was rejected.
*/
reject(reason: any): void;
}