aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-06-20 16:14:45 -0300
committerSebastian <sebasjm@gmail.com>2021-06-20 16:14:56 -0300
commit7f3ce304cb4e699fff61703ad5700770c7cf507e (patch)
tree9a261626d6b4cba0f927e4677f3009d784600607 /packages/taler-wallet-webextension
parent221e71b91623bd38e71d6325ed66a998fe9f7ffd (diff)
missing globalThis Polyfill, remove duplicate url util
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r--packages/taler-wallet-webextension/src/compat.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/taler-wallet-webextension/src/compat.ts b/packages/taler-wallet-webextension/src/compat.ts
index 4635abd80..36846e615 100644
--- a/packages/taler-wallet-webextension/src/compat.ts
+++ b/packages/taler-wallet-webextension/src/compat.ts
@@ -19,6 +19,21 @@
* WebExtension APIs consistently.
*/
+// 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__;
+})();
+
export function isFirefox(): boolean {
const rt = chrome.runtime as any;
if (typeof rt.getBrowserInfo === "function") {