Skip to content

Commit d663f20

Browse files
authored
fix: fix event-driven background pages by awaiting heartbeat calls (#153)
1 parent 0232562 commit d663f20

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/background/heartbeat.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const sendInitialHeartbeat = async (client: AWClient) => {
5858
const activeWindowTab = await getActiveWindowTab()
5959
const tabs = await getTabs()
6060
console.debug('Sending initial heartbeat', activeWindowTab)
61-
heartbeat(client, activeWindowTab, tabs.length)
61+
await heartbeat(client, activeWindowTab, tabs.length)
6262
}
6363

6464
export const heartbeatAlarmListener =
@@ -68,7 +68,7 @@ export const heartbeatAlarmListener =
6868
if (!activeWindowTab) return
6969
const tabs = await getTabs()
7070
console.debug('Sending heartbeat for alarm', activeWindowTab)
71-
heartbeat(client, activeWindowTab, tabs.length)
71+
await heartbeat(client, activeWindowTab, tabs.length)
7272
}
7373

7474
export const tabActivatedListener =
@@ -77,5 +77,5 @@ export const tabActivatedListener =
7777
const tab = await getTab(activeInfo.tabId)
7878
const tabs = await getTabs()
7979
console.debug('Sending heartbeat for tab activation', tab)
80-
heartbeat(client, tab, tabs.length)
80+
await heartbeat(client, tab, tabs.length)
8181
}

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"background": {
2222
"{{chrome}}.service_worker": "src/background/main.ts",
2323
"{{firefox}}.scripts": ["src/background/main.ts"],
24-
"{{firefox}}.persistent": true
24+
"{{firefox}}.persistent": false
2525
},
2626

2727
"options_ui": {

0 commit comments

Comments
 (0)