@@ -114,6 +114,7 @@ self.addEventListener('notificationclick', (event) => {
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
if (clients.openWindow) {
|
||||
console.log('open new window', urlToOpen)
|
||||
|
||||
@@ -121,15 +122,15 @@ self.addEventListener('notificationclick', (event) => {
|
||||
if (!client) {
|
||||
console.log('new window not opened')
|
||||
for (const client of clientList) {
|
||||
client.postMessage({
|
||||
type: 'notificationClick',
|
||||
url: urlToOpen,
|
||||
tag: event.notification.tag,
|
||||
payload: event.notification.payload,
|
||||
matchUrl: false,
|
||||
msg: 'new window not opened',
|
||||
})
|
||||
break
|
||||
return client.navigate(urlToOpen)
|
||||
// return client.postMessage({
|
||||
// type: 'notificationClick',
|
||||
// url: urlToOpen,
|
||||
// tag: event.notification.tag,
|
||||
// payload: event.notification.payload,
|
||||
// matchUrl: false,
|
||||
// msg: 'new window not opened',
|
||||
// })
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -137,15 +138,15 @@ self.addEventListener('notificationclick', (event) => {
|
||||
console.log('clients.openWindow not available')
|
||||
|
||||
for (const client of clientList) {
|
||||
client.postMessage({
|
||||
type: 'notificationClick',
|
||||
url: urlToOpen,
|
||||
tag: event.notification.tag,
|
||||
payload: event.notification.payload,
|
||||
matchUrl: false,
|
||||
msg: 'clients.openWindow not available',
|
||||
})
|
||||
break
|
||||
return client.navigate(urlToOpen)
|
||||
// return client.postMessage({
|
||||
// type: 'notificationClick',
|
||||
// url: urlToOpen,
|
||||
// tag: event.notification.tag,
|
||||
// payload: event.notification.payload,
|
||||
// matchUrl: false,
|
||||
// msg: 'clients.openWindow not available',
|
||||
// })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user