Changes for page LiveTableServiceWorker
Last modified by bougault on 2022/03/22 17:19
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -1,16 +1,16 @@ 1 -console.log('hello sw'); 2 -self.addEventListener('fetch', function(event) { 3 -/* 4 - event.respondWith( 5 - fetch(event.request).then(function(response) { 6 - if (response.status === 404) { 7 - return fetch("/path/to/404error.gif"); 8 - } 9 - return response; 10 - }).catch(function() { 11 - return new Response("Uh oh, that totally failed!"); 12 - }) 13 - ); 14 -*/ 1 +self.addEventListener("install" , evt => { 2 + //evt.waitUntil(caches.open("main_cache").then(cache => cache.addAll(["/", "/something"]))); 3 + console.log(evt); 4 + 5 + self.skipWaiting(); 15 15 }); 16 16 8 +self.addEventListener("activate" , evt => { 9 + console.log(evt); 10 + clients.claim(); 11 +}); 12 + 13 +self.addEventListener("fetch" , evt => { 14 + console.log(evt); 15 +}); 16 +