aboutsummaryrefslogtreecommitdiff
path: root/src/webex/wxBackend.ts
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-11-02 15:54:43 +0000
committerng0 <ng0@n0.is>2019-11-02 15:54:43 +0000
commit5e05c22c57dfd6ed28516f10e3460567c3bbfc08 (patch)
tree0cfb3ee75054e04f626f6274d4718af2d2bd89e1 /src/webex/wxBackend.ts
parentd5794f507b77110584eb38ec8be362b7ce3cca67 (diff)
parent70a232294035b2a08a701391495b65fdff696b7a (diff)
Merge branch 'master' of git.taler.net:wallet-core
Diffstat (limited to 'src/webex/wxBackend.ts')
-rw-r--r--src/webex/wxBackend.ts19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts
index 564ee24f0..16cd2a78c 100644
--- a/src/webex/wxBackend.ts
+++ b/src/webex/wxBackend.ts
@@ -547,19 +547,26 @@ function injectScript(
});
}
-/**
- * Main function to run for the WebExtension backend.
- *
- * Sets up all event handlers and other machinery.
- */
-export async function wxMain() {
+try {
+ // This needs to be outside of main, as Firefox won't fire the event if
+ // the listener isn't created synchronously on loading the backend.
chrome.runtime.onInstalled.addListener(details => {
+ console.log("onInstalled with reason", details.reason);
if (details.reason === "install") {
const url = chrome.extension.getURL("/src/webex/pages/welcome.html");
chrome.tabs.create({ active: true, url: url });
}
});
+} catch (e) {
+ console.error(e);
+}
+/**
+ * Main function to run for the WebExtension backend.
+ *
+ * Sets up all event handlers and other machinery.
+ */
+export async function wxMain() {
// Explicitly unload the extension page as soon as an update is available,
// so the update gets installed as soon as possible.
chrome.runtime.onUpdateAvailable.addListener(details => {