The Worbox activated
event is one way but I'd like to know outside of this event.
Is there some kind of function/method I could call on-demand to check if the registered service worker is installed/active? Like isServiceWorkerActive()
or something like that?
I can only think of navigator.serviceWorker.controller.state == 'activated'
, is that the proper way of achieving this?
I'm not sure if this helps, but you can check it easily in Chrome using the DevTools. Click on the Application tab and make sure you have Service Workers selected in the sidebar. If it's installed, it should show the current service worker along with pertinent information and options such as update and unregister.