diff options
Diffstat (limited to 'src/sw.js')
| -rw-r--r-- | src/sw.js | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -56,7 +56,6 @@ self.addEventListener('push', async (event) => { self.addEventListener('message', async (event) => { const { type, content } = event.data - console.log(event) if (type === 'desktopNotification') { const { title, ...rest } = content @@ -81,6 +80,11 @@ self.addEventListener('notificationclick', (event) => { event.waitUntil(getWindowClients().then((list) => { for (let i = 0; i < list.length; i++) { const client = list[i] + client.postMessage({ type: 'notificationClicked', id: event.notification.tag }) + } + + for (let i = 0; i < list.length; i++) { + const client = list[i] if (state.lastFocused === null || client.id === state.lastFocused) { if ('focus' in client) return client.focus() } |
