Promise API

The Promise global object is used for deferred and asynchronous computations. A Promise represents an operation that hasn't completed yet, but is expected to in the future.

13 Total 11 Methods 2 Properties 9 Statics
  Show all

new Promise(…)

Creates a new Promise object.Promise.Promise(executor)

[Symbol.toStringTag]

The initial value of the @@toStringTag property is the String value "Promise".p[Symbol.toStringTag]

Promise.all(…)

Returns a promise that either fulfills when all of the promises in the iterable argument have fulfilled or rejects when one of the promises in the iterable argument rejects.Promise.all(iterable)

Promise.allSettled(…)

Returns a promise that fulfills after all of the given promises have either fulfilled or rejected, with an array of objects that each describe the outcome of each promise.Promise.allSettled(iterable)

Promise.any(…)

Takes an iterable of Promise objects and, as soon as one of the promises in the iterable fulfills, returns a single promise that resolves with the value from that promise.Promise.any(iterable)

catch(…)

Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is fulfilled.p.catch(onRejected)

finally(…)

Appends a handler to the promise, and returns a new promise that is resolved when the original promise is resolved. The handler is called when the promise is settled, whether fulfilled or rejected.p.finally(onFinally)

Promise.prototype

The prototype of the Promise constructor.Promise.prototype

Promise.race(…)

Returns a promise that fulfills or rejects as soon as one of the promises in the iterable fulfills or rejects, with the value or reason from that promise.Promise.race(iterable)

Promise.reject(…)

Returns a Promise object that is rejected with the given reason.Promise.reject(reason)

Promise.resolve(…)

Returns a Promise object that is resolved with the given value.Promise.resolve([value])

then(…)

Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.p.then([onFulfilled, [onRejected]])

Promise.withResolvers()

Returns an object containing a new Promise and two functions to resolve or reject it.Promise.withResolvers()

[Symbol.toStringTag]

property

The initial value of the @@toStringTag property is the String value "Promise". p[Symbol.toStringTag]

You seem to be offline. App may not work.