Replace polling with server sent events
This commit is contained in:
@ -31,18 +31,6 @@ export async function markNotificationsAsSeen(arn: AnimeNotifier) {
|
||||
credentials: "same-origin"
|
||||
})
|
||||
|
||||
// Update notification counter
|
||||
if("serviceWorker" in navigator) {
|
||||
// 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"
|
||||
})
|
||||
} else {
|
||||
// If there is no service worker, update the counter on this tab
|
||||
arn.notificationManager.update()
|
||||
}
|
||||
|
||||
// Update notifications
|
||||
arn.reloadContent()
|
||||
}
|
Reference in New Issue
Block a user