service worker fix

This commit is contained in:
Jonas Weinz 2019-03-21 15:54:06 +01:00
parent 34c4e82330
commit 3634076c73

23
sw.js
View File

@ -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);
});