Polymer auto-register method on platinum-sw-register element

272 views Asked by At

I have installed the getting started polymer app (yo polymer).

And I am setting the auto-register to false on the platinum-sw-register element.

As I am not calling the elements register method I do not expect the service worker to be registered. But in chrome dev tools I can see service worker which seems to be activated and running even after deleting it and refreshing the page.

Am I misunderstanding what this property is used for? I was expecting not to see the service worker in the chrome dev tools until I manually called the register method on the element.

1

There are 1 answers

3
Jeff Posnick On

You've got a correct understanding of what that property is for.

I'd recommend using a new Chrome Incognito window when experimenting with service workers (including those registered via <platinum-sw-register>). It ensures that you'll start fresh each time.

I just modified a local copy of the demo to remove the document.querySelector('platinum-sw-register').register(); call, and confirmed that in an Incognito window, there's no service worker registration listed under chrome://serviceworker-internals/. So the property appears to be behaving as intended.