Promise.withResolvers()
Newly available since 2024-03-05
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.
Learning resources on MDN
Browser support
- Chrome 119 Released on 2023-10-31
- Chrome Android 119 Released on 2023-10-31
- Edge 119 Released on 2023-11-02
- Firefox 121 Released on 2023-12-19
- Firefox for Android 121 Released on 2023-12-19
- Safari 17.4 Released on 2024-03-05
- Safari on iOS 17.4 Released on 2024-03-05
Specifications
- ECMAScript Language Specification (#sec-promise.withResolvers), from TC39 (Ecma International).