Favorites

JavaScript Promise.withResolvers() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Promise.withResolvers()
JavaScript Promise Static methodThis method is supported by most modern browsers, though support in some browsers is unknown.
Updated 28th November 2026

The Promise.withResolvers() static method creates a new promise and returns it together with its resolve and reject functions, so it can be settled from outside.

Description

The Promise.withResolvers() static method returns a new promise along with the resolve and reject functions that control it. It replaces the pattern of creating a promise and copying those functions out of the executor into outer variables, which is common when wrapping event-based APIs.

Typical uses include turning a one-off event into a promise, such as waiting for a dialog to close, building queues where a task's promise is fulfilled later by a worker, and testing code that waits for promises. The returned functions can be called from anywhere, as many times as you like, but only the first call has any effect.

Before this method existed, the same result needed a few lines of boilerplate: declaring resolve and reject variables and assigning them inside new Promise((res, rej) => { ... }).

Syntax

Promise.withResolvers()

Return Value

An object with promise, resolve and reject properties.

Example

const { promise, resolve } = Promise.withResolvers();
setTimeout(() => resolve('Ready'), 200);
promise.then(console.log);

Browser Support

The following information will show you the current browser support for the Promise.withResolvers() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by most modern browsers, though support in some browsers is unknown.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee