add missing 'alarm' permission
This commit is contained in:
parent
c3c0f3bfbb
commit
df81496b57
@ -13,7 +13,8 @@
|
|||||||
"permissions": [
|
"permissions": [
|
||||||
"unlimitedStorage",
|
"unlimitedStorage",
|
||||||
"activeTab",
|
"activeTab",
|
||||||
"scripting"
|
"scripting",
|
||||||
|
"alarms"
|
||||||
],
|
],
|
||||||
"optional_permissions": [
|
"optional_permissions": [
|
||||||
"webRequest"
|
"webRequest"
|
||||||
|
@ -45,8 +45,12 @@ export class ServiceWorkerTimerAPI implements TimerAPI {
|
|||||||
const seconds = delayMs / 1000;
|
const seconds = delayMs / 1000;
|
||||||
const periodInMinutes = Math.round(seconds < 61 ? 1 : seconds / 60);
|
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.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();
|
return new AlarmHandle();
|
||||||
}
|
}
|
||||||
@ -58,8 +62,12 @@ export class ServiceWorkerTimerAPI implements TimerAPI {
|
|||||||
const seconds = delayMs / 1000;
|
const seconds = delayMs / 1000;
|
||||||
const delayInMinutes = Math.round(seconds < 61 ? 1 : seconds / 60);
|
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.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();
|
return new AlarmHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user