Skip to content

Instantly share code, notes, and snippets.

@gitgrimbo
Created February 16, 2019 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitgrimbo/b1edd73b9137877aa2e5be44d192fa54 to your computer and use it in GitHub Desktop.
Save gitgrimbo/b1edd73b9137877aa2e5be44d192fa54 to your computer and use it in GitHub Desktop.
Service Worker Tips

Service Worker

These tips from https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle.

A service worker won't receive events like fetch and push until it successfully finishes installing and becomes "active".

Use this knowledge in combination with the next point.

By default, a page's fetches won't go through a service worker unless the page request itself went through a service worker. So you'll need to refresh the page to see the effects of the service worker.

So a service worker that wasn't installed initially, but has since been installed and actually become active, won't start handling fetch requests for the current page. You have to reload the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment