UNPKG

react-async-iterators

Version:

The magic of JavaScript async iterators in React ⛓️ 🧬 🔃

20 lines 860 B
"use strict"; 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