Last active
September 13, 2021 10:11
-
-
Save zwacky/dc32dd881ba64357e4e8b93c122db949 to your computer and use it in GitHub Desktop.
the wrapped service-worker in index.html can then be called if any update is available
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
// listen to the service worker promise in index.html to see if there has been a new update. | |
// condition: the service-worker.js needs to have some kind of change - e.g. increment CACHE_VERSION. | |
window['isUpdateAvailable'] | |
.then(isAvailable => { | |
if (isAvailable) { | |
const toast = this.toastCtrl.create({ | |
message: 'New Update available! Reload the webapp to see the latest juicy changes.', | |
position: 'bottom', | |
showCloseButton: true, | |
}); | |
toast.present(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment