Code Monkey home page Code Monkey logo

self-destroying-sw's Issues

Publish to NPM

Pls publish this package to npm, great work btw ๐Ÿ‘

current logic doesn't delete cache storage entries

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);
            })
          )
        })
      });
});

Environment setting

It would be awesome to be able to destroy this based on the current environment. Would you accept a PR for that?

While destroying the service worker need to empty cache storage.

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:

  1. De-register the service worker.
  2. Empty the cache storage and indexdb storage.

First point I achieved through this repository. Can you help me achieve the second point.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.