diff options
Diffstat (limited to 'build.js')
| -rw-r--r-- | build.js | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -219,11 +219,15 @@ const SW_WAKE_ONLY = `self.addEventListener('push', (e) => { }); self.addEventListener('notificationclick', (e) => { e.notification.close(); + const d = (e.notification && e.notification.data) || {}; e.waitUntil((async () => { const all = await self.clients.matchAll({ type: 'window', includeUncontrolled: true }); const open = all.find((c) => 'focus' in c); - if (open) return open.focus(); - if (self.clients.openWindow) return self.clients.openWindow('./'); + if (open) { + if (d.view) { try { open.postMessage({ type: 'open', view: d.view }); } catch (_) {} } + return open.focus(); + } + if (self.clients.openWindow) return self.clients.openWindow(d.url || './'); })()); });`; |
