Mark all notifications as seen syncs all tabs

This commit is contained in:
2018-03-20 18:27:57 +01:00
parent d6efc2b861
commit 24b0036617
3 changed files with 61 additions and 40 deletions

View File

@ -30,7 +30,16 @@ export async function markNotificationsAsSeen(arn: AnimeNotifier) {
})
// Update notification counter
arn.notificationManager.update()
if(!("serviceWorker" in navigator)) {
// If there is no service worker, update the counter on this tab
arn.notificationManager.update()
} else {
// If we have service worker support, broadcast the "notifications marked as seen" message to all open tabs
arn.serviceWorkerManager.postMessage({
type: "broadcast",
realType: "notifications marked as seen"
})
}
// Update notifications
arn.reloadContent()