Skip to content

Commit

Permalink
Only register the notification click handler once (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmr1993 authored Mar 2, 2022
1 parent 61c2216 commit 8b254f3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions source/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ async function onTabUpdated(tabId, changeInfo, tab) {
}
}

function onNotificationClick(id) {
openNotification(id);
}

async function addHandlers() {
const {updateCountOnNavigation} = await optionsStorage.getAll();

if (await queryPermission('notifications')) {
browser.notifications.onClicked.addListener(id => {
openNotification(id);
});
browser.notifications.onClicked.addListener(onNotificationClick);
}

if (await queryPermission('tabs')) {
Expand Down

0 comments on commit 8b254f3

Please sign in to comment.