Skip to content

Instantly share code, notes, and snippets.

@Tiorzfk
Created May 27, 2017 18:53
Show Gist options
  • Save Tiorzfk/a5117cd0bc272f847585c1eba3d6c20e to your computer and use it in GitHub Desktop.
Save Tiorzfk/a5117cd0bc272f847585c1eba3d6c20e to your computer and use it in GitHub Desktop.
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful ');
}).catch(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