[whatwg] ApplicationCache spec questions

Hey there-

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.

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?

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.

Thanks!

- pamela

- pamela

Received on Tuesday, 17 February 2009 15:50:18 UTC