diff options
author | Sebastian <sebasjm@gmail.com> | 2022-04-11 15:41:01 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-04-11 15:41:01 -0300 |
commit | df81496b5755bfe071ce2212ed300bf127af0b8a (patch) | |
tree | 7f035d2dfe1f91037a667c53191b91bff9ed07c8 /packages/taler-wallet-webextension | |
parent | c3c0f3bfbb700f617c4fdfa0926c4ce5289c4449 (diff) |
add missing 'alarm' permission
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r-- | packages/taler-wallet-webextension/manifest-v3.json | 5 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/serviceWorkerTimerAPI.ts | 12 |
2 files changed, 13 insertions, 4 deletions
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(); } |