ServiceWorkerRegistration.active and friends return null#8784
ServiceWorkerRegistration.active and friends return null#8784jespertheend wants to merge 1 commit intoGoogleChrome:mainfrom
Conversation
|
Once a service worker is installed, those values should be null, because the service worker has been activated after the next page refresh. Try the following in the console to check if a service worker is activated post-install: const reg = await navigator.serviceWorker.getRegistration("/js/sw.js");
console.log(reg.active.state);Also beware that if a service worker is not located at the root, its scope will be restricted to whatever folder it's in. You can specify a cc: @jakearchibald |
|
Ah, I see what you were referring to here. I think this change makes sense, but didn't fully understand where you were coming from at first. Still, it'd be a good idea if @jakearchibald took a look at this, since this is a guide he wrote. |
|
Ah sorry my bad, I should have been more clear there. So just to be clear: I think an older version of the spec said that these values would be |
Changes proposed in this pull request:
The
installing,waitingandactivegetters on a ServiceWorkerRegistration returnnullnow. I reckon this is outdated.ServiceWorkerRegistration.activeon mdn