Skip to content

Instantly share code, notes, and snippets.

@FlorianRappl
Created July 2, 2018 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlorianRappl/b55300acbda3eca776069e43c176f00e to your computer and use it in GitHub Desktop.
Save FlorianRappl/b55300acbda3eca776069e43c176f00e to your computer and use it in GitHub Desktop.
async function registerServiceWorker() {
try {
const registration = await navigator.serviceWorker.register('sw.js');
// do something with registration, e.g., registration.scope
} catch (e) {
console.error('ServiceWorker failed', e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment