Skip to content

Instantly share code, notes, and snippets.

@adrienZ
Last active March 3, 2019 13:13
Show Gist options
  • Select an option

  • Save adrienZ/9a42a57dd3e79e31a149fe1e6d6a74ef to your computer and use it in GitHub Desktop.

Select an option

Save adrienZ/9a42a57dd3e79e31a149fe1e6d6a74ef to your computer and use it in GitHub Desktop.
Service Worker registration
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js')
.then(function(registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function(error) {
console.log('Service worker registration failed, error:', error);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment