W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

[IndexedDB] Why rely on run-to-completion?

From: Axel Rauschmayer <axel@rauschma.de>
Date: Wed, 29 Dec 2010 23:44:57 +0100
Message-Id: <13D97ABE-222B-4A59-82FB-97202C997A3E@rauschma.de>
To: public-webapps@w3.org
Can someone explain a bit more about the motivation behind the current design of the async API? 

> var request = window.indexedDB.open(...);
> request.onsuccess = function(event) { ... };

The pattern of assigning the success continuation after invoking the operation seems to be to closely tied to JavaScript’s current run-to-completion event handling. But what about future JavaScript environments, e.g. a multi-threaded Node.js with IndexedDB built in or Rhino with IndexedDB running in parallel? Wouldn’t a reliance on run-to-completion unnecessarily limit future developments?

Maybe it is just me, but I would like it better if the last argument was an object with the error and the success continuations (they could also be individual arguments). That is also how current JavaScript RPC APIs are designed, resulting in a familiar look. Are there any arguments *against* this approach?

Whatever the reasoning behind the design, I think it should be explained in the spec, because the current API is a bit tricky to understand for newbies.



Dr. Axel Rauschmayer
### Hyena: organize your ideas, free at hypergraphs.de/hyena/
Received on Wednesday, 29 December 2010 22:45:25 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:28 UTC