[whatwg] executeSql API is synchronous

Aaron Boodman aa at google.com
Thu Sep 20 10:13:02 PDT 2007


On Sep 20, 2007 1:22 AM, Maciej Stachowiak <mjs at apple.com> wrote:

> FWIW the async model would probably be easier to implement in the
> short run than worker threads, and we'd be hesitant to implement
> worker threads at all without a clear spec for which APIs should be
> available on worker threads. But in the long run I think having both
> is reasonable.


Agree.

That said, it will be even more common with databases to have multiple
asynchronous operations in a row than it is today with XHR. Doing this all
asynchronously will be incredibly painful.

I have done some thought on how to simplify the worker api, and I think it
could be as easy as:

var w = createWorker("foo.js");
w.sendMessage("messageName", jsonStyleObject);
w.addEventListener("messageName", function(e) {
  // e.args is a jsonStyleObject that was sent from the worker.
}, false);

Inside the worker:

worker.addEventListener("messageName", function(e) {
  // e.args is a jsonStyleObject that was sent from the worker.
}, false);
w.sendMessage("messageName", jsonStyleObject);

The main complication then will just be adding back access to the APIs you
need: XHR, database, cookies, timers, onerror, etc.

- a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070920/9333da85/attachment.htm>


More information about the whatwg mailing list