W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

[IndexedDB] Syntax for opening a cursor

From: Jeremy Orlow <jorlow@chromium.org>
Date: Thu, 24 Jun 2010 21:25:35 +0100
Message-ID: <AANLkTikyuovV-E7qljdexqDEX3TP_L6yhonSoEKZjjF6@mail.gmail.com>
To: public-webapps WG <public-webapps@w3.org>
If I'm reading the current spec right (besides the "[NoInterfaceObject]"
attributes that I thought Nikunj was going to remove), if I want to open a
cursor, this is what I need to do:

myObjectStore.openCursor(new IDBKeyRange().leftBound("key"), new

Note that I'm creating 2 objects which get thrown away after using the
constructor and constant.  This seems pretty wasteful.

Jonas' proposal (which I guess Nikunj is currently in the middle of
implementing?) makes things a bit better:


or, when you have a single key that you're looking for, you can use the
short hand

myObjectStore.openCursor("key", new IDBCursor().PREV);

But even in these examples, we're creating a needless object.  I believe we
could also use the prototype to grab the constant, but the syntax is still
pretty verbose and horrid.

Can't we do better?

Received on Thursday, 24 June 2010 20:26:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 13:55:34 UTC