Changes for page LiveTableServiceWorker
Last modified by bougault on 2022/03/22 17:19
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,0 +1,1 @@ 1 +Main.WebHome - Content
-
... ... @@ -1,0 +1,5 @@ 1 +{{velocity output="false"}} 2 +$response.setContentType("text/javascript") 3 +{{/velocity}} 4 + 5 +console.log('toto');
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -1,17 +1,16 @@ 1 -console.log('hello sw'); 2 -self.addEventListener('fetch', function(event) { 3 -console.log('sw', event); 4 -/* 5 - event.respondWith( 6 - fetch(event.request).then(function(response) { 7 - if (response.status === 404) { 8 - return fetch("/path/to/404error.gif"); 9 - } 10 - return response; 11 - }).catch(function() { 12 - return new Response("Uh oh, that totally failed!"); 13 - }) 14 - ); 15 -*/ 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(); 16 16 }); 17 17 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 +