Created
May 3, 2012 22:01
-
-
Save kristenhazard/2589850 to your computer and use it in GitHub Desktop.
Communicate applicationCache status
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
appCache = window.applicationCache; | |
appCache.addEventListener "cached", (event) => | |
# show good message | |
appCache.addEventListener "noupdate", (event) => | |
# show good message | |
appCache.addEventListener "updateready", (event) => | |
# swap out cache and let user know new page available | |
# reload page to get latest | |
appCache.swapCache() | |
appCache.addEventListener "error", (event) => | |
# we will get an error if offline | |
if app.OfflineSupport.workOffline | |
# show good message | |
else | |
# show bad message, reload page to fix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment