Skip to content

Instantly share code, notes, and snippets.

@cheshirewara
Created February 22, 2019 06:48
Show Gist options
  • Save cheshirewara/fcb49a17d814488687ad3f2247b93b7d to your computer and use it in GitHub Desktop.
Save cheshirewara/fcb49a17d814488687ad3f2247b93b7d to your computer and use it in GitHub Desktop.
var superpwa_sw = {"url":"/serviceWorker.js"};
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register(superpwa_sw.url)
.then(function(registration) { console.log('PWA service worker ready'); registration.update(); })
.catch(function(error) { console.log('Registration failed with ' + error); });
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment