We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is my sw.js
const staticDevCoffee = "dev-coffee-site-v1"; const dynamicCacheName = "dev-coffee-dynamic-v4"; const assets = [ "/", "/index.html", "/fallback.html", "/about.html", "/contact.html", "/blog.html", "/css/style.css", "/js/app.js", "/images/coffee1.jpg", "/images/coffee2.jpg", "/images/coffee3.jpg", "/images/coffee4.jpg", "/images/coffee5.jpg", "/images/coffee6.jpg", "/images/coffee7.jpg", "/images/coffee8.jpg", "/images/coffee9.jpg", ] self.addEventListener("install", installEvent => { installEvent.waitUntil( caches.open(staticDevCoffee).then(cache => { cache.addAll(assets) }) ); }); self.addEventListener('activate', activateEvent => { activateEvent.waitUntil( caches.keys().then(keys => { return Promise.all(keys .filter(key => key !== staticDevCoffee && key !== dynamicCacheName) .map(key => caches.delete(key)) ); }) ); }); self.addEventListener('fetch', fetchEvent => { if(!(fetchEvent.request.url.indexOf("http") === 0)) return fetchEvent.respondWith( caches.match(fetchEvent.request).then(cacheRes => { return cacheRes || fetch(fetchEvent.request).then(fetchRes => { return caches.open(staticDevCoffee).then(cache => { cache.put(fetchEvent.request.url, fetchRes.clone()); return fetchRes; }) }); }).catch(()=> caches.match("/fallback.html")) ); });
After adding cache delete method in fetch method sw returning staticCacheName but empty
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is my sw.js
After adding cache delete method in fetch method sw returning staticCacheName but empty
The text was updated successfully, but these errors were encountered: