diff options
Diffstat (limited to 'packages/taler-util/src/url.ts')
-rw-r--r-- | packages/taler-util/src/url.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/taler-util/src/url.ts b/packages/taler-util/src/url.ts index b50b4b466..a52d80362 100644 --- a/packages/taler-util/src/url.ts +++ b/packages/taler-util/src/url.ts @@ -56,6 +56,21 @@ export interface URLCtor { new (url: string, base?: string | URL): URL; } +// globalThis polyfill, see https://mathiasbynens.be/notes/globalthis +(function () { + if (typeof globalThis === "object") return; + Object.defineProperty(Object.prototype, "__magic__", { + get: function () { + return this; + }, + configurable: true, // This makes it possible to `delete` the getter later. + }); + // @ts-ignore: polyfill magic + __magic__.globalThis = __magic__; // lolwat + // @ts-ignore: polyfill magic + delete Object.prototype.__magic__; +})(); + // @ts-ignore const _URL = globalThis.URL; if (!_URL) { |