Class: Promise

Promise

Promise

Constructor

new Promise()

Promise class with a little extension
Parameters:
Type Description
PromiseCallback.<T>
Source:

Methods

(static) all(promises) → {Promise.<Array.<*>>}

Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
Parameters:
Name Type Description
promises Array.<(Promise.<*>|*)>
Source:
Returns:
Type
Promise.<Array.<*>>

(static) defer() → {Deferred}

Returns a deferred object
Source:
Returns:
Type
Deferred

(static) reject(reason) → {Promise}

Returns rejecting promise with given reason
Parameters:
Name Type Description
reason Error Rejecting reason
Source:
Returns:
Type
Promise

(static) resolve(result) → {Promise}

Returns resolving promise with given reason
Parameters:
Name Type Description
result * Resolved value
Source:
Returns:
Type
Promise

catch(onRejected) → {Promise.<S>}

A sugar method, equivalent to promise.then(undefined, onRejected).
Parameters:
Name Type Description
onRejected RejectedCallback.<S>
Source:
Returns:
Type
Promise.<S>

fail(onRejected) → {Promise.<S>}

Synonym of Promise#catch
Parameters:
Name Type Description
onRejected RejectedCallback.<S>
Source:
Returns:
Type
Promise.<S>

then(onFulfilledopt, onRejectedopt) → {Promise.<(S1|S2)>}

The "then" method from the Promises/A+ specification
Parameters:
Name Type Attributes Description
onFulfilled FulfilledCallback.<T, S1> <optional>
onRejected RejectedCallback.<S2> <optional>
Source:
Returns:
Type
Promise.<(S1|S2)>

thenCall(callbackopt) → {Promise}

Call "then" using given node-style callback function. This is basically same as "nodeify" except that it always return the original promise
Parameters:
Name Type Attributes Description
callback Callback.<T> <optional>
Callback function
Source:
Returns:
Type
Promise