One of the cool features of NS Basic/App Studio is that apps can be installed to the Home screen and run even if the device is offline. It does this by caching the files the app uses.
There have been some questions about how offline apps get cached: how do you tell if you app is being updated with a fresh copy?
It turns out there are some nice events you can watch. You could use these to put up a progress dialog, or a warning to wait until the update is complete. The events only appear if you are downloading a deployed version – they do not fire if you are running locally.
Here’s the important code – a good place to put it is in the global code section.
window.applicationCache.addEventListener("checking", logEvent, false)
window.applicationCache.addEventListener("downloading", logEvent, false)
window.applicationCache.addEventListener("noupdate", logEvent, false)
window.applicationCache.addEventListener("progress", logEvent, false)
window.applicationCache.addEventListener("updateready", logEvent, false)
Function logEvent(e)
print e.type
End Function