diff --git a/packages/taler-wallet-webextension/manifest-v3.json b/packages/taler-wallet-webextension/manifest-v3.json index de25cf6c5..576b263fa 100644 --- a/packages/taler-wallet-webextension/manifest-v3.json +++ b/packages/taler-wallet-webextension/manifest-v3.json @@ -13,7 +13,8 @@ "permissions": [ "unlimitedStorage", "activeTab", - "scripting" + "scripting", + "alarms" ], "optional_permissions": [ "webRequest" @@ -32,4 +33,4 @@ "background": { "service_worker": "dist/background.js" } -} +} \ No newline at end of file diff --git a/packages/taler-wallet-webextension/src/serviceWorkerTimerAPI.ts b/packages/taler-wallet-webextension/src/serviceWorkerTimerAPI.ts index f2b6ee7a2..89b46c796 100644 --- a/packages/taler-wallet-webextension/src/serviceWorkerTimerAPI.ts +++ b/packages/taler-wallet-webextension/src/serviceWorkerTimerAPI.ts @@ -45,8 +45,12 @@ export class ServiceWorkerTimerAPI implements TimerAPI { const seconds = delayMs / 1000; const periodInMinutes = Math.round(seconds < 61 ? 1 : seconds / 60); + logger.trace(`creating a alarm every ${periodInMinutes} ${delayMs}`) chrome.alarms.create("wallet-worker", { periodInMinutes }) - chrome.alarms.onAlarm.addListener(callback) + chrome.alarms.onAlarm.addListener((a) => { + logger.trace(`alarm called, every: ${a.name}`) + callback() + }) return new AlarmHandle(); } @@ -58,8 +62,12 @@ export class ServiceWorkerTimerAPI implements TimerAPI { const seconds = delayMs / 1000; const delayInMinutes = Math.round(seconds < 61 ? 1 : seconds / 60); + logger.trace(`creating a alarm after ${delayInMinutes} ${delayMs}`) chrome.alarms.create("wallet-worker", { delayInMinutes }) - chrome.alarms.onAlarm.addListener(callback) + chrome.alarms.onAlarm.addListener((a) => { + logger.trace(`alarm called, after: ${a.name}`) + callback(); + }) return new AlarmHandle(); }