Promise

Back to documentation index.

new Promise([resolver])

A promise holds a value to be resolved in the future.

This class is a "polyfill" for the standard Promise class; it is only used when the running JavaScript environment doesn't support or include a Promise class on its own.

Parameters

Methods

(static) Promise.all(all)

Wait for all these promises to complete. One failed => this fails too.

Parameters

Return Value

A promise that is resolved when all promises have resolved. (Type: Promise)

(static) Promise.race(all)

Creates a promise that resolves or is rejected when one of those promises resolves or is rejected.

Parameters

Return Value

A promise that resolves or is rejected according to the first promise that resolves or is rejected. It will receive the value associated with that promise. (Type: Promise)

(static) Promise.reject(reason)

Returns a promise that is rejected.

Parameters

Return Value

A promise that is rejected and takes the given value as its argument. (Type: Promise)

(static) Promise.resolve(value)

Returns a promise that resolves.

Parameters

Return Value

A promise that resolves and takes the given value as its argument. (Type: Promise)

Back to documentation index.