On Wed, 18 Feb 2009, pamela fox wrote: > > I was looking through the ApplicationCache API description (e.g. > http://www.whatwg.org/specs/web-apps/current-work/#handler-appcache-onnoupdate) > > and am trying to figure out, as a web developer, what my code might look > like for using window.applicationCache. The description of the events in > the ApplicationCache API isn't very specific, and it takes a while to > sort through the former section to see when the browser fires each event > (particularly for events like "progress" which is a common word in the > spec). It might be helpful to link back to that section when describing > the events, or to duplicate the "UI should show to the user".. > descriptions.
I've tried to add some explanatory text: http://www.whatwg.org/specs/web-apps/current-work/#offline How is it? > The following code shows what I think would be the messages to show to > a user for each situation. > > var appCache = window.applicationCache; > if (appCache.status == ApplicationCache.UNCACHED) { > alert("Not cached yet"); > } > > appCache.checking = function() { > alert("Checking for updates"); > } > appCache.onprogress= function() { > alert("Downloading new resources"); > } > appCache.ondownloading = function() { > alert("Downloading the new manifest"); > } > appCache.onupdateready = function() { > alert("There's a new version of the app available. Reload to see it."); > } > appCache.onnoupdate = function() { > alert("No updates necessary. Carry on."); > } > appCache.oncached = function() { > alert("Cached now! You can use this offline."); > } > appCache.onobsolete = function() { > alert("The app is no longer available offline. Sorry, we decided not > to enable that feature anymore"); > } > appCache.onerror = function() { > alert("Ruh oh, there was an error trying to cache this app for > offline use. Our bad!"); > } > > Do those alerts seem like a fair description? Yup, that's exactly right. > Also - one little thing- onnoupdate is a hard function name to parse, > from an English perspective. It took me a while to separate it into > on-no-update. Yeah... not sure what to do about this really. Oh well. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'