Skip to content

Instantly share code, notes, and snippets.

@rishi-raj-jain
Created January 23, 2022 11:46
Show Gist options
  • Save rishi-raj-jain/7776bb41e923166846c71eb667d5f977 to your computer and use it in GitHub Desktop.
Save rishi-raj-jain/7776bb41e923166846c71eb667d5f977 to your computer and use it in GitHub Desktop.
<script>
// Check that service workers are supported
if ('serviceWorker' in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js');
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment