diff options
Diffstat (limited to 'packages/taler-util')
| -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) {  | 
