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

Re: Indexed DB + Promises

From: Jake Archibald <jakearchibald@google.com>
Date: Tue, 06 Oct 2015 11:11:42 +0000
Message-ID: <CAPy=JoozBxDNRgTgTsGejFVsTrO9wWo-e4LpX6R03AnXKvck5Q@mail.gmail.com>
To: Joshua Bell <jsbell@google.com>, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Kyle Huey <me@kylehuey.com>, Domenic Denicola <d@domenic.me>, "public-webapps@w3.org" <public-webapps@w3.org>
On Mon, 5 Oct 2015 at 23:31 Joshua Bell <jsbell@google.com> wrote:

> Yeah - "When control is returned to the event loop" isn't precise enough.
> It's an open issue in the 2nd Ed. and I welcome suggestions for tightening
> it up. Note that Jake Archibald, at least, was happy with the Blink
> behavior, after chewing on it for a bit. But it still seems far too subtle
> to me, and someone who writes blog posts explaining tasks vs. microtasks is
> probably not the average consumer of the API. :)

Step 8 of https://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction can
queue a microtask to unset the active flag. It would mean:

var tx = db.transaction(…);

Promise.resolve().then(_ => {
  // transaction is now closed

…but if you want to keep the transaction open longer, that's what waitUntil
is for.

As for https://w3c.github.io/IndexedDB/#fire-a-success-event - this seems
fine as long as microtasks fire before step 4, which they should.
Received on Tuesday, 6 October 2015 11:12:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:58 UTC