Publier Globinours 1.0.0-rc.3
This commit is contained in:
parent
ea8c24d622
commit
9a2b4068da
325 changed files with 38230 additions and 20 deletions
5
public/service-worker.js
Normal file
5
public/service-worker.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
const CACHE = 'globinours-shell-v2';
|
||||
const SHELL = ['/manifest.webmanifest','/favicon.ico','/pwa-icon-192.png','/pwa-icon-512.png','/assets/logo-globinours-64.png','/assets/mobile.css','/assets/pwa.js'];
|
||||
self.addEventListener('install', event => event.waitUntil(caches.open(CACHE).then(cache => cache.addAll(SHELL)).then(() => self.skipWaiting())));
|
||||
self.addEventListener('activate', event => event.waitUntil(caches.keys().then(keys => Promise.all(keys.filter(key => key !== CACHE).map(key => caches.delete(key)))).then(() => self.clients.claim())));
|
||||
self.addEventListener('fetch', event => {const request=event.request;if(request.method!=='GET')return;const url=new URL(request.url);if(url.origin!==location.origin||request.mode==='navigate'||!SHELL.includes(url.pathname))return;event.respondWith(caches.match(request).then(cached=>cached||fetch(request)));});
|
||||
Loading…
Add table
Add a link
Reference in a new issue