diff options
author | Sebastian <sebasjm@gmail.com> | 2021-06-20 16:14:45 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-06-20 16:14:56 -0300 |
commit | 7f3ce304cb4e699fff61703ad5700770c7cf507e (patch) | |
tree | 9a261626d6b4cba0f927e4677f3009d784600607 /packages/taler-util/src | |
parent | 221e71b91623bd38e71d6325ed66a998fe9f7ffd (diff) | |
download | wallet-core-7f3ce304cb4e699fff61703ad5700770c7cf507e.tar.xz |
missing globalThis Polyfill, remove duplicate url util
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r-- | packages/taler-util/src/index.ts | 1 | ||||
-rw-r--r-- | packages/taler-util/src/url.ts | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts index 2e1c68765..3e49cea10 100644 --- a/packages/taler-util/src/index.ts +++ b/packages/taler-util/src/index.ts @@ -19,3 +19,4 @@ export * from "./transactionsTypes.js"; export * from "./walletTypes.js"; export * from "./i18n.js"; export * from "./logging.js"; +export * from "./url.js"; 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) { |