@ungap/with-resolvers

June 19, 2023 ยท View on GitHub

A Promise.withResolvers() polyfill.

import '@ungap/with-resolvers';
// require('@ungap/with-resolvers');

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

promise.then(console.log, console.error);
resolve(Math.random());