Skip to content

Instantly share code, notes, and snippets.

@kristenhazard
Created May 3, 2012 22:01
Show Gist options
  • Save kristenhazard/2589850 to your computer and use it in GitHub Desktop.
Save kristenhazard/2589850 to your computer and use it in GitHub Desktop.
Communicate applicationCache status
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