diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-11-02 00:46:57 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-11-02 00:46:57 +0100 |
commit | d6a3a54d28a5d1e21cc3cca9927c78f674044531 (patch) | |
tree | 6a1c7da3e73305ecbf12e67fcbbbe1fbe6bfe302 /src/webex/wxBackend.ts | |
parent | 574e6ce37ccf11fb15788937239acf79d76a8c20 (diff) | |
download | wallet-core-d6a3a54d28a5d1e21cc3cca9927c78f674044531.tar.xz |
installation popup in FF
Diffstat (limited to 'src/webex/wxBackend.ts')
-rw-r--r-- | src/webex/wxBackend.ts | 19 |
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 => { |