From ec2937ec1f3b0ae153f79604eb35b57ffe0f9af2 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 13 Nov 2023 17:29:25 +0200 Subject: add options for marking single notification as read --- src/sw.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/sw.js') 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 -- cgit v1.2.3-70-g09d2