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

50 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
2022-06-06 17:05:26 +02:00
(C) 2022 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.
*/
2023-01-04 19:44:28 +01:00
import { platform, setupPlatform } from "./platform/background.js";
2022-03-29 04:41:07 +02:00
import chromeAPI from "./platform/chrome.js";
2022-04-21 20:39:30 +02:00
import firefoxAPI from "./platform/firefox.js";
2022-03-29 04:41:07 +02:00
import { wxMain } from "./wxBackend.js";
2022-06-06 05:09:25 +02:00
const isFirefox =
typeof (window as any) !== "undefined" &&
typeof (window as any)["InstallTrigger"] !== "undefined";
2022-06-06 05:09:25 +02:00
// FIXME: create different entry point for any platform instead of
2022-03-25 20:57:27 +01:00
// switching in runtime
if (isFirefox) {
2022-06-06 05:09:25 +02:00
setupPlatform(firefoxAPI);
} else {
2022-06-06 05:09:25 +02:00
setupPlatform(chromeAPI);
}
2022-04-21 20:39:30 +02:00
// setGlobalLogLevelFromString("trace")
async function start() {
await platform.notifyWhenAppIsReady();
await wxMain();
}
start();