summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/background.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/background.ts')
-rw-r--r--packages/taler-wallet-webextension/src/background.ts31
1 files changed, 25 insertions, 6 deletions
diff --git a/packages/taler-wallet-webextension/src/background.ts b/packages/taler-wallet-webextension/src/background.ts
index dcbf96139..7df66eff8 100644
--- a/packages/taler-wallet-webextension/src/background.ts
+++ b/packages/taler-wallet-webextension/src/background.ts
@@ -1,6 +1,6 @@
/*
This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
+ (C) 2022 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -17,14 +17,33 @@
/**
* Entry point for the background page.
*
- * @author Florian Dold
+ * @author sebasjm
*/
/**
* Imports.
*/
-import { wxMain } from "./wxBackend";
+import { platform, setupPlatform } from "./platform/background.js";
+import chromeAPI from "./platform/chrome.js";
+import firefoxAPI from "./platform/firefox.js";
+import { wxMain } from "./wxBackend.js";
-window.addEventListener("load", () => {
- wxMain();
-});
+const isFirefox =
+ typeof (window as any) !== "undefined" &&
+ typeof (window as any)["InstallTrigger"] !== "undefined";
+
+// FIXME: create different entry point for any platform instead of
+// switching in runtime
+if (isFirefox) {
+ setupPlatform(firefoxAPI);
+} else {
+ setupPlatform(chromeAPI);
+}
+
+// setGlobalLogLevelFromString("trace")
+
+async function start() {
+ await platform.notifyWhenAppIsReady();
+ await wxMain();
+}
+start();