service worker fix
This commit is contained in:
parent
34c4e82330
commit
3634076c73
23
sw.js
23
sw.js
@ -35,25 +35,6 @@ self.addEventListener('install', function(e) {
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
event.waitUntil(async function() {
|
||||
const allClients = await clients.matchAll({
|
||||
includeUncontrolled: true
|
||||
});
|
||||
|
||||
var instance = None;
|
||||
|
||||
|
||||
// Let's see if we already have a window open:
|
||||
for (const client of allClients) {
|
||||
client.focus();
|
||||
instance = client;
|
||||
break;
|
||||
}
|
||||
|
||||
// If we didn't find an existing window,
|
||||
// open a new one:
|
||||
if (!instance) {
|
||||
instance = await clients.openWindow(rel_home);
|
||||
}
|
||||
}());
|
||||
event.notification.close();
|
||||
clients.openWindow(rel_home);
|
||||
});
|
Loading…
Reference in New Issue
Block a user