fusionjs / fusion-plugin-service-worker

Migrated to https://github.com/fusionjs/fusionjs
MIT License
6 stars 8 forks source link

Service worker should unregister itself on js uncaught exception #144

Open cdlewis opened 5 years ago

cdlewis commented 5 years ago

I think it would be helpful to have the service worker attempt to unregister itself if there's a JS error. Helps stop people from shooting themselves in the foot. I'm open to taking this assuming it's possible / you agree it would be helpful.

angus-c commented 5 years ago

There's already a try/catch around fetch. Currently that will delete the cache. I could also send a post message to the client which will trigger an unregister, but it would re-register on next page load. I think that's a good balance.