You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-csc-ui/public/service-worker.js

18 lines
546 B

self.addEventListener('notificationclick', function (event) {
event.notification.close()
var promiseChain = clients.matchAll({
type: 'window',
includeUncontrolled: true
}).then((windowClients) => {
var matchingClient = null
for (var i = 0; i < windowClients.length; i++) {
var windowClient = windowClients[i]
if (windowClient.url === event.notification.data.url) {
return windowClient.focus()
}
}
})
event.waitUntil(promiseChain)
})