yyx990803 / register-service-worker

A script to simplify service worker registration with hooks for common events.
MIT License
638 stars 58 forks source link

After unregistering invalid SW there is a call to serviceWorker.ready #36

Open assemblethis opened 4 years ago

assemblethis commented 4 years ago

In either of the two cases where checkValidServiceWorker returns after determining that the SW is invalid (not a js content-type, or a 404 error), the SW will be unregistered, but then after the call to checkValidServiceWorker returns, the script will wait for the SW to be ready. Why wait for the SW to be ready when you've just unregistered it?

https://github.com/yyx990803/register-service-worker/blob/cedb35fdb41ef626e948211000fa3938fcf1e682/src/index.js#L33-L34

Is this intended or a bug?