Created
August 1, 2018 02:37
-
-
Save ThaddeusJiang/2f57b546d0afaf81d98fb0b090336589 to your computer and use it in GitHub Desktop.
Hello Workbox!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Hello Workbox!</title> | |
</head> | |
<body> | |
<div> | |
<h1>Hello Workbox!</h1> | |
</div> | |
<script> | |
// Check that service workers are registered | |
if ('serviceWorker' in navigator) { | |
// Use the window load event to keep the page load performant | |
window.addEventListener('load', () => { | |
navigator.serviceWorker.register('/sw.js'); | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment