summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/platform/dev.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/platform/dev.ts')
-rw-r--r--packages/taler-wallet-webextension/src/platform/dev.ts36
1 files changed, 18 insertions, 18 deletions
diff --git a/packages/taler-wallet-webextension/src/platform/dev.ts b/packages/taler-wallet-webextension/src/platform/dev.ts
index d57072c80..1a4183bec 100644
--- a/packages/taler-wallet-webextension/src/platform/dev.ts
+++ b/packages/taler-wallet-webextension/src/platform/dev.ts
@@ -23,18 +23,17 @@ import {
MessageFromBackend,
MessageFromFrontend,
MessageResponse,
+ defaultSettings,
} from "./api.js";
const frames = ["popup", "wallet"];
const api: BackgroundPlatformAPI & ForegroundPlatformAPI = {
isFirefox: () => false,
+ getSettingsFromStorage: () => Promise.resolve(defaultSettings),
keepAlive: (cb: VoidFunction) => cb(),
findTalerUriInActiveTab: async () => undefined,
findTalerUriInClipboard: async () => undefined,
- containsTalerHeaderListener: () => {
- return true;
- },
getPermissionsApi: () => ({
addPermissionsListener: () => undefined,
containsHostPermissions: async () => true,
@@ -47,21 +46,23 @@ const api: BackgroundPlatformAPI & ForegroundPlatformAPI = {
getWalletWebExVersion: () => ({
version: "none",
}),
- notifyWhenAppIsReady: (fn: () => void) => {
+ notifyWhenAppIsReady: () => {
let total = frames.length;
- function waitAndNotify(): void {
- total--;
- if (total < 1) {
- fn();
- }
- }
- frames.forEach((f) => {
- const theFrame = window.frames[f as any];
- if (theFrame.location.href === "about:blank") {
- waitAndNotify();
- } else {
- theFrame.addEventListener("load", waitAndNotify);
+ return new Promise((fn) => {
+ function waitAndNotify(): void {
+ total--;
+ if (total < 1) {
+ fn();
+ }
}
+ frames.forEach((f) => {
+ const theFrame = window.frames[f as any];
+ if (theFrame.location.href === "about:blank") {
+ waitAndNotify();
+ } else {
+ theFrame.addEventListener("load", waitAndNotify);
+ }
+ });
});
},
@@ -80,9 +81,8 @@ const api: BackgroundPlatformAPI & ForegroundPlatformAPI = {
},
registerAllIncomingConnections: () => undefined,
- registerOnInstalled: (fn: () => void) => undefined,
+ registerOnInstalled: () => Promise.resolve(),
registerReloadOnNewVersion: () => undefined,
- registerTalerHeaderListener: () => undefined,
useServiceWorkerAsBackgroundProcess: () => false,