client.navigate
Deploy frontend / frontend (push) Successful in 1m3s

This commit is contained in:
2024-12-02 19:13:08 +02:00
parent 7b5cfebe80
commit 4f85aa0f98
+19 -18
View File
@@ -114,6 +114,7 @@ self.addEventListener('notificationclick', (event) => {
]) ])
} }
} }
if (clients.openWindow) { if (clients.openWindow) {
console.log('open new window', urlToOpen) console.log('open new window', urlToOpen)
@@ -121,15 +122,15 @@ self.addEventListener('notificationclick', (event) => {
if (!client) { if (!client) {
console.log('new window not opened') console.log('new window not opened')
for (const client of clientList) { for (const client of clientList) {
client.postMessage({ return client.navigate(urlToOpen)
type: 'notificationClick', // return client.postMessage({
url: urlToOpen, // type: 'notificationClick',
tag: event.notification.tag, // url: urlToOpen,
payload: event.notification.payload, // tag: event.notification.tag,
matchUrl: false, // payload: event.notification.payload,
msg: 'new window not opened', // matchUrl: false,
}) // msg: 'new window not opened',
break // })
} }
} }
}) })
@@ -137,15 +138,15 @@ self.addEventListener('notificationclick', (event) => {
console.log('clients.openWindow not available') console.log('clients.openWindow not available')
for (const client of clientList) { for (const client of clientList) {
client.postMessage({ return client.navigate(urlToOpen)
type: 'notificationClick', // return client.postMessage({
url: urlToOpen, // type: 'notificationClick',
tag: event.notification.tag, // url: urlToOpen,
payload: event.notification.payload, // tag: event.notification.tag,
matchUrl: false, // payload: event.notification.payload,
msg: 'clients.openWindow not available', // matchUrl: false,
}) // msg: 'clients.openWindow not available',
break // })
} }
} }
}) })