I want to completely remove a service worker from my website that I initially put there without really thinking about it. I tried the unregister method from react-scripts v1.0.17 default registerServerWorker.js implementation:
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
In the Chrome dev tools, I see that the service worker is affected by the call to unregister: a '- deleted' appears next to the hostname and the "update" and "unregister" links are greyed out. But the state is still "activated and is running". If I unregister it manually with the dev tools it disappears completely, like I would expect. This makes me think that the programmtic unregister command is failing or maybe not enough.
I tried looking up how to stop an SW programmatically but the examples only talk about unregistration. Can somebody shed some light on this?