Skip to content

Instantly share code, notes, and snippets.

@denar90
Created October 22, 2017 20:45
Show Gist options
  • Save denar90/e28810ee8d7bd30d1e89ffb264cda55b to your computer and use it in GitHub Desktop.
Save denar90/e28810ee8d7bd30d1e89ffb264cda55b to your computer and use it in GitHub Desktop.
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js').then(function(registration) {
// Registration was successful
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