[whatwg] Offline Web Apps

On Oct 12, 2007 12:53 PM, Ian Hickson <ian at hixie.ch> wrote:

> The problem with isLocallyAvailable() -- as noted by Maciej on IRC -- is
> mostly one of race conditions. What if the resource was removed in between
> you asking for it and using it? Or added?
>

In the contexts for which it was requested, race conditions are tolerable.
For example in a mapping application, if you choose the wrong tile as a
template for zooming, then you get an ugly transition but that's all. Or you
might have a button that opens another offline application, and you want to
disable the button if you think that application is not available; here a
race condition would probably mean that the button is enabled but pressing
it gives you an error page. In these cases isLocallyAvailable can be a
useful hint even if it's occasionally wrong.

Or what if you go offline (thus
changing the rules) in between checking for and using the resource?

That's why we have the 'whenOffline' parameter.

I'm going to punt on this for now, pending implementation and author
> experience. I'm certainly open to suggestions though.
>

That's fine.

A race-free API seems difficult to design. Because loads are typically
asynchronous, I doubt you can do much better than start a regular load, and
set a timer to go off and cancel the load and take other action if the load
doesn't complete "fast enough". Overkill if all you want is the hint, and
since authors can already do that but there's still demand for
isLocallyAvailable, I suspect that's not really what's wanted.

Rob
-- 
"Two men owed money to a certain moneylender. One owed him five hundred
denarii, and the other fifty. Neither of them had the money to pay him back,
so he canceled the debts of both. Now which of them will love him more?"
Simon replied, "I suppose the one who had the bigger debt canceled." "You
have judged correctly," Jesus said. [Luke 7:41-43]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20071012/b7f7639b/attachment.htm>

Received on Thursday, 11 October 2007 18:47:36 UTC