← Reference

Async APIs

Promise-based APIs and async patterns.

fetch()

The Fetch API provides a JavaScript interface for making HTTP requests across the network, returning Promises that resolve to Response objects.

fetch(input[, init])

Promise

A built-in object for handling asynchronous operations, representing a value that may be available now, in the future, or never.

Promise.all()

Waits for all promises in an iterable to resolve, or rejects if any promise rejects.

Promise.allSettled()

Waits for all promises to settle, returning results for both resolved and rejected promises.

Promise.any()

Returns a promise that resolves as soon as any one of the promises in the iterable resolves.

Promise.prototype.catch()

Attaches a rejection handler to a Promise, returning a new Promise.

catch(onRejected)

Promise.prototype.finally()

Attaches a callback that runs when a Promise settles, regardless of outcome.

finally(onFinally)

Promise.prototype.then()

Attaches fulfillment and rejection handlers to a Promise, returning a new Promise.

then(onFulfilled)

Promise.race()

Returns a promise that resolves or rejects as soon as one of the promises in the iterable resolves or rejects.

Promise.reject()

Creates a Promise object that is rejected with a given reason, useful for testing error handling or returning failed promises conditionally.

Promise.resolve()

Returns a Promise object that is resolved with a given value.