Skip to content

Instantly share code, notes, and snippets.

@FezVrasta
Created July 31, 2019 18:36
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 FezVrasta/d7a3f6d0ecd59ef23780a1af35cda36d to your computer and use it in GitHub Desktop.
Save FezVrasta/d7a3f6d0ecd59ef23780a1af35cda36d to your computer and use it in GitHub Desktop.
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
// WE ADD THE CODE BELOW
if (registration.waiting) {
if (config && config.onWaiting) {
config.onWaiting(registration.waiting);
}
}
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment