nekr / self-destroying-sw Goto Github PK
View Code? Open in Web Editor NEWCode-snippets and guides on removing ServiceWorker from a websiste.
License: MIT License
Code-snippets and guides on removing ServiceWorker from a websiste.
License: MIT License
Pls publish this package to npm, great work btw ๐
If this plugin is enabled, then no caching features are enabled?
I mean if the service worker is invalidated each time? When would it work? Only when is offline?
Should add cleanup logic:
self.addEventListener('install', function(e) {
self.skipWaiting();
});
self.addEventListener('activate', function(e) {
self.registration.unregister()
.then(function() {
return self.clients.matchAll();
})
.then(function(clients) {
clients.forEach(client => client.navigate(client.url));
return Promise.resolve();
})
.then(() => {
self.caches.keys().then(function(cacheNames) {
Promise.all(
cacheNames.map(function(cacheName) {
return self.caches.delete(cacheName);
})
)
})
});
});
It would be awesome to be able to destroy this based on the current environment. Would you accept a PR for that?
I was using Offline plugin (configuration same as in react-boilerplate) for offline usage in a react app. But due to some business related reason we had to stop the caching in cache storage.
I removed the Offline plugin but the existing installed service worker continues to cache the files.
While going through the issues I came across this repository.
I want to achieve 2 things:
First point I achieved through this repository. Can you help me achieve the second point.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.