Files
plainleaf/web/polyfills.ts
T
2025-09-11 09:14:44 +02:00

11 lines
327 B
TypeScript

// Source: https://github.com/ungap/with-resolvers/blob/main/index.js
// @ts-ignore This is fine
Promise.withResolvers || (Promise.withResolvers = function withResolvers() {
let a, b;
const c = new this(function (resolve, reject) {
a = resolve;
b = reject;
});
return { resolve: a, reject: b, promise: c };
});