Created
May 27, 2017 12:40
-
-
Save ketola/e0b6bdd090c49414aa90ab64b90e2862 to your computer and use it in GitHub Desktop.
Application registers the service worker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check for service worker support in the browser | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('/sw.js').then(function(registration) { | |
// Registration was successful | |
console.log('ServiceWorker registration successful with scope: ', registration.scope); | |
}, function(err) { | |
// registration failed :( | |
console.log('ServiceWorker registration failed: ', err); | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment