aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/static
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/static')
-rw-r--r--src/main/resources/static/sw.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/resources/static/sw.js b/src/main/resources/static/sw.js
index 48fe7787..055fcf64 100644
--- a/src/main/resources/static/sw.js
+++ b/src/main/resources/static/sw.js
@@ -22,8 +22,12 @@ sw.addEventListener('push', function(evt) {
}
});
sw.addEventListener('notificationclick', function(evt) {
- evt.notification.close();
evt.waitUntil(
- sw.clients.openWindow('https://juick.com/')
+ sw.clients.matchAll().then(function(clientList) {
+ if (clientList.length > 0) {
+ return clientList[0].focus();
+ }
+ return sw.clients.openWindow('https://juick.com/');
+ })
);
});