aboutsummaryrefslogtreecommitdiff
path: root/src/sw.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-11-13 17:29:25 +0200
committerHenry Jameson <me@hjkos.com>2023-11-13 17:29:25 +0200
commitec2937ec1f3b0ae153f79604eb35b57ffe0f9af2 (patch)
tree43f77d71432accfbd90dc9747224c22c1393293c /src/sw.js
parentc059f4a7ee16c0128c348c43c9d468e7cfdb5ef7 (diff)
add options for marking single notification as read
Diffstat (limited to 'src/sw.js')
-rw-r--r--src/sw.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sw.js b/src/sw.js
index b95d56a4..43c1c2e2 100644
--- a/src/sw.js
+++ b/src/sw.js
@@ -66,6 +66,12 @@ self.addEventListener('message', async (event) => {
self.registration.showNotification(title, rest)
}
+ if (type === 'desktopNotificationClose') {
+ const { id, all } = content
+ const search = all ? null : { tag: id }
+ self.registration.getNotifications(search).forEach(n => n.close())
+ }
+
if (type === 'updateFocus') {
state.lastFocused = event.source.id