4 var notifications = [];
6 self.addEventListener('install', function(e) {
7 e.waitUntil(self.skipWaiting()); // Activate worker immediately
10 self.addEventListener('activate', function(e) {
11 e.waitUntil(self.clients.claim()); // Become available to all pages
14 self.addEventListener('notificationclick', function(e) {
15 var notification = e.notification;
16 var action = e.action;
23 e.waitUntil(clients.matchAll({
24 includeUncontrolled: true,
26 }).then(function(clients) {
27 for (var i = 0; i < clients.length; i++) {
28 clients[i].postMessage({
30 id: notification.data.id