2017-01-17 14:28:28 +00:00
|
|
|
import 'typings-global';
|
|
|
|
export interface IResolve<T> {
|
|
|
|
(value?: T | Promise<T>): void;
|
|
|
|
}
|
|
|
|
export interface IReject {
|
|
|
|
(reason?: any): void;
|
|
|
|
}
|
|
|
|
export declare class Deferred<T> {
|
|
|
|
promise: Promise<T>;
|
|
|
|
resolve: IResolve<T>;
|
|
|
|
reject: IReject;
|
|
|
|
constructor();
|
|
|
|
}
|
|
|
|
export declare let defer: <T>() => Deferred<T>;
|
2017-01-20 20:58:53 +00:00
|
|
|
/**
|
|
|
|
* Creates a new resolved promise for the provided value.
|
|
|
|
*/
|
2017-01-20 23:45:11 +00:00
|
|
|
export declare let resolvedPromise: <T>(value?: T) => Promise<T>;
|
2017-01-20 20:58:53 +00:00
|
|
|
/**
|
|
|
|
* Creates a new rejected promise for the provided reason.
|
|
|
|
*/
|
2017-01-20 23:45:11 +00:00
|
|
|
export declare let rejectedPromise: (err: any) => Promise<never>;
|