wallet-core/packages/taler-wallet-webextension/src/background.ts

54 lines
1.4 KiB
TypeScript
Raw Normal View History

2015-12-25 22:42:14 +01:00
/*
2021-09-13 18:33:13 +02:00
This file is part of GNU Taler
(C) 2021 Taler Systems S.A.
2015-12-25 22:42:14 +01:00
2021-09-13 18:33:13 +02:00
GNU Taler is free software; you can redistribute it and/or modify it under the
2015-12-25 22:42:14 +01:00
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
2021-09-13 18:33:13 +02:00
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
2015-12-25 22:42:14 +01:00
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
2021-09-13 18:33:13 +02:00
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
2015-12-25 22:42:14 +01:00
*/
2016-02-09 21:56:06 +01:00
/**
* Entry point for the background page.
*
2022-02-23 19:18:37 +01:00
* @author sebasjm
2016-02-09 21:56:06 +01:00
*/
2017-05-24 16:14:23 +02:00
/**
* Imports.
*/
import { platform, setupPlatform } from "./platform/api";
import firefoxAPI from "./platform/firefox"
import chromeAPI from "./platform/chrome"
2019-11-02 00:46:57 +01:00
import { wxMain } from "./wxBackend";
const isFirefox = typeof (window as any)['InstallTrigger'] !== 'undefined'
//FIXME: create different entry point for any platform instead of
//switching in runtime
if (isFirefox) {
console.log("Wallet setup for Firefox API")
setupPlatform(firefoxAPI)
} else {
console.log("Wallet setup for Chrome API")
setupPlatform(chromeAPI)
}
try {
platform.registerOnInstalled(() => {
platform.openWalletPage("/welcome")
})
} catch (e) {
console.error(e);
}
platform.notifyWhenAppIsReady(() => {
wxMain();
})