W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2010

Re: [IndexedDB] Promises (WAS: Seeking pre-LCWD comments for Indexed Database API; deadline February 2)

From: Aaron Boodman <aa@google.com>
Date: Fri, 5 Mar 2010 09:22:11 -0800
Message-ID: <278fd46c1003050922v1c4ef484r1a5f94cd9a158d2e@mail.gmail.com>
To: Jeremy Orlow <jorlow@chromium.org>
Cc: Nikunj Mehta <nikunj@o-micron.com>, Kris Zyp <kris@sitepen.com>, public-webapps WG <public-webapps@w3.org>
On Fri, Mar 5, 2010 at 4:54 AM, Jeremy Orlow <jorlow@chromium.org> wrote:
> For what it's worth, regardless of the answers to the above questions, I
> think we should switch to a callback based model.  It's great to use events
> when natural to do so, but this is a very unnatural use.  It provides
> artificial limitations (only one request in flight at a time, per request
> object).  It's ugly and confusing syntax wise (hard to keep track of which
> request object is associated with which request method, requires multiple
> statements to do each request, requires the handlers to be placed prior to
> the actual call...which is why the async example
> in http://www.w3.org/TR/IndexedDB/#introduction is so difficult to read,
> etc).  And there really isn't any precedent (that I'm aware of) for using
> events like this.  And the web developers I've spoken to have all been
> confused by the async API.

I agree the current model is confusing. It looks like it is emulating
DOM events like document.onclick. That is fine when there is only one
document, but it makes no sense when you specifically create each
request, but you have to listen for the result on a shared onrequest
object.

What happened to following the pattern of SQLDatabase. Other than the
fact that it was SQL, I thought that was pretty elegant. It can also
be easily made to work synchronously if that is a requirement.

- a
Received on Friday, 5 March 2010 17:22:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:37 GMT