Last active
June 23, 2017 12:39
-
-
Save bennypowers/2e1f2f015aa2e83d23dc9c24a607d39d to your computer and use it in GitHub Desktop.
New Version Available. Click to Reload
This file contains 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
// Polymer Starter Kit App | |
// my-app, in `ready` callback | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('/service-worker.js') | |
.then((registration) => { | |
registration.onupdatefound = (event) => { | |
let installingWorker = registration.installing; | |
installingWorker.onstatechange = (event) => { | |
switch (installingWorker.state) { | |
case 'redundant': | |
this._log.error('The installing service-worker was redundant'); | |
break; | |
case 'installed': | |
this._log.debug(`Service worker ${installingWorker.state}`); | |
return this.$.swtoast.open(); | |
} | |
}; | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment