-
Notifications
You must be signed in to change notification settings - Fork 0
Promise class
Ron Buckton edited this page Jan 15, 2015
·
1 revision
Represents the completion of an asynchronous operation.
export declare class Promise<T> {
constructor(init: (resolve: (value?: IPromise<T> | T) => void, reject: (reason?: any) => void) => void);
public static resolve<T>(value: IPromise<T> | T): Promise<T>;
public static resolve(): Promise<void>;
public static reject<T>(reason: any): Promise<T>;
public static reject(reason: any): Promise<void>;
public static all<T>(values: Array<IPromise<T> | T>): Promise<T[]>;
public static all(values: IPromise<void>[]): Promise<void>;
public static race<T>(values: Array<IPromise<T> | T>): Promise<T>;
public then<TResult>(onfulfilled?: (value: T) => IPromise<TResult> | TResult, onrejected?: (reason: any) => IPromise<TResult> | TResult): Promise<TResult>;
public catch(onrejected: (reason: any) => IPromise<T> | T): Promise<T>;
public finally(onsettled: () => IPromise<void> | void): Promise<T>;
}- T
- The type of the result produced by this Promise.
- new Promise(Function)
- Creates a new instance of the Promise class.
- static resolve(any?)
- Creates a Promise that is resolved with the provided value.
- static reject(any)
- Creates a Promise that is rejected with the provided reason.
- static all(Array)
- Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
- static race(Array)
- Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
- then(Function?, Function?)
- Attaches callbacks for the resolution and/or rejection of the Promise.
- catch(Function)
- Attaches a callback for only the rejection of the Promise.
- finally(Function)
- Attaches a callback for that is executed regardless of the resolution or rejection of the Promise.
- Supported Platforms: TBD
- Module: promise
- Library: promise.ts