Skip to content

Commit 0d65aad

Browse files
committed
hedge against alarm not being defined
1 parent 42cb685 commit 0d65aad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/utils/alarm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function setupCookieAlarm(initial = false) {
99
permissions: ['alarms', 'cookies'],
1010
})) as boolean;
1111

12-
if (!granted) {
12+
if (!granted || !chrome.alarms) {
1313
return;
1414
}
1515

@@ -32,7 +32,7 @@ export async function setupCookieAlarm(initial = false) {
3232
}
3333

3434
function createAlarmListener() {
35-
chrome.alarms.onAlarm.addListener(async (alarm) => {
35+
chrome.alarms?.onAlarm?.addListener(async (alarm) => {
3636
if (alarm.name !== COOKIE_ALARM_NAME) {
3737
return;
3838
}

0 commit comments

Comments
 (0)