What is the API for deregistering work services in Chrome> = 44?

I am trying to unregister an already installed worker. I understand that the registration promise is being registered as an argument to the success function, and I could store that in some scope, but that would not work after a page reload (I would like to be able to unregister an installed worker in a previous session). I tried to find an id defined in registration that would allow me to get it later, but that doesn't seem to exist.

This page mentions navigator.serviceWorker.unregister (this will take scope as an argument) but it is not defined in my environment (Chrome 44, Linux). Not implemented yet? Is there a workaround that I could currently use?

+3


source to share


1 answer


From a SW managed doc, this will unregister (CR41 +):

navigator.serviceWorker.getRegistration().then(function(r) { 
  r.unregister();
});

      



In Chrome, you can also check which SW files are active and undo them from chrome: // serviceworker-internals

+13


source







All Articles