qyu
Version:
A general-purpose asynchronous job queue for Node.js
20 lines • 860 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.promiseWithResolvers = void 0;
const promiseWithResolvers = 'withResolvers' in Promise
? () => Promise.withResolvers()
: /**
* A ponyfill for the [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) helper
* @returns A pending {@link PromiseWithResolvers} instance for use
*/
function promiseWithResolversPonyfill() {
let resolve;
let reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { promise, resolve, reject };
};
exports.promiseWithResolvers = promiseWithResolvers;
//# sourceMappingURL=promiseWithResolvers.js.map
;