Last active
March 31, 2018 19:25
-
-
Save devNigel/c55ec416a1761cd5fe85de3fff7dc8bd to your computer and use it in GitHub Desktop.
Beginner’s Guide to Converting a Javascript App to a Progressive Web App (PWA)
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
| if ('serviceWorker' in navigator) { | |
| window.addEventListener('load', function() { | |
| navigator.serviceWorker.register('/sw.js').then(function(registration) { | |
| // Registration was successful | |
| console.log('ServiceWorker registration successful with scope: ', registration.scope); | |
| }, function(err) { | |
| // registration failed :( | |
| console.log('ServiceWorker registration failed: ', err); | |
| }); | |
| }); | |
| } | |
| /* | |
| game logic | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment