We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0dc9aa commit c46c82dCopy full SHA for c46c82d
1 file changed
sw.js
@@ -1,4 +1,4 @@
1
-const CACHE_NAME = 'pomodoro-v8';
+const CACHE_NAME = 'pomodoro-v9';
2
const ASSETS = [
3
'./',
4
'./index.html',
@@ -32,6 +32,18 @@ self.addEventListener('message', e => {
32
}
33
});
34
35
+self.addEventListener('notificationclick', e => {
36
+ e.notification.close();
37
+ e.waitUntil(
38
+ self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then(clients => {
39
+ if (clients.length) {
40
+ return clients[0].focus();
41
+ }
42
+ return self.clients.openWindow('./');
43
+ })
44
+ );
45
+});
46
+
47
self.addEventListener('fetch', e => {
48
if (e.request.method !== 'GET') return;
49
if (!e.request.url.startsWith(self.location.origin)) return;
0 commit comments