W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

Re: [Bug 10400] New: [IndexedDB] IDBCursor.continue should return an IDBRequest

From: Jeremy Orlow <jorlow@chromium.org>
Date: Thu, 19 Aug 2010 20:06:07 +0100
Message-ID: <AANLkTimJFQJov0A7HdA7b-WC6G41SOuMTyepJu-F4wCB@mail.gmail.com>
To: ben turner <bent.mozilla@gmail.com>
Cc: public-webapps@w3.org
On Thu, Aug 19, 2010 at 7:22 PM, ben turner <bent.mozilla@gmail.com> wrote:

> Sorry, I replied on the bug rather than to the list. Here's what I said:
>
> Hm, I think the wording in the spec is bad, but I believe this bug is
> invalid.
> The way we envisioned this for the async api is that calling continue()
> always
> returns true (to match sync api, but it's really pointless) and the
> original
> event listener is called again. There is no new request object. So it works
> like this:
>
>  var request = objectStore.openCursor();
>  request.onsuccess = function (event) {
>    var cursor = event.result;
>    if (cursor) {
>      // Do something...
>      alert(cursor.value);
>      // And again...
>      cursor.continue();
>    }
>    else {
>      // No more values...
>    }
>  }
>
> This way you don't have to define multiple request objects and event
> listeners.
>
> For the sync api, I think it should work very similarly:
>
>  var cursor = objectStore.openCursor();
>  if (cursor) {
>    do {
>      // Do something..
>      alert(cursor.value);
>    } while (cursor.continue());
>  }
>

I responded on list already.  Let's continue the discussion there.
Received on Thursday, 19 August 2010 19:06:58 GMT

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