Skip to content

Instantly share code, notes, and snippets.

@n3tr
Created March 17, 2016 19:20
Show Gist options
  • Save n3tr/b66c30320c500dd1d6f2 to your computer and use it in GitHub Desktop.
Save n3tr/b66c30320c500dd1d6f2 to your computer and use it in GitHub Desktop.
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-workerw.js').then(function(registration) {
// register success
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).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