Skip to content

Instantly share code, notes, and snippets.

@FezVrasta
Created July 31, 2019 18:35
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/c6f4e1d1235c7c2c6349b557509b3ee3 to your computer and use it in GitHub Desktop.
Save FezVrasta/c6f4e1d1235c7c2c6349b557509b3ee3 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