coderef

Promise.withResolvers()Baseline · Widely available

The Promise.withResolvers() static method is an alternative to the Promise() constructor that returns both the promise and resolution functions. You can use this to access resolve and reject outside the scope of the executor function.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Mar 5, 2024. Widely available since Sep 5, 2026.

Browser support

DesktopChrome
1–118Not supported
119+Supportedsince Oct 31, 2023
Current: 155
Edge
12–118Not supported
119+Supportedsince Nov 2, 2023
Current: 154
Firefox
1–120Not supported
121+Supportedsince Dec 19, 2023
Current: 157
Safari
1–17.3Not supported
17.4+Supportedsince Mar 5, 2024
Current: 27
MobileChrome Android
18–118Not supported
119+Supportedsince Oct 31, 2023
Current: 155
Firefox Android
4–120Not supported
121+Supportedsince Dec 19, 2023
Current: 157
Safari iOS
1–17.3Not supported
17.4+Supportedsince Mar 5, 2024
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

JS
const { promise, resolve, reject } = Promise.withResolvers();

button.addEventListener("click", () => resolve("clicked"), { once: true });
setTimeout(() => reject(new Error("timeout")), 5000);

console.log(await promise);

Feature detection

JS · check before using
if ("withResolvers" in Promise || ("prototype" in Promise && "withResolvers" in Promise.prototype)) {
  // Promise.withResolvers is available
}