[IndexedDB] Proposal: Queue a microtask to unset active on transaction (#27)

Ported from https://www.w3.org/Bugs/Public/show_bug.cgi?id=29049 by @jakearchibald

When a transaction is created, 'active' is unset when control is returned to the event loop http://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction (8).

When onsuccess is fired, 'active' is unset once the event has dispatched http://w3c.github.io/IndexedDB/#fire-a-success-event (4).

If both of these were "queue a microtask to unset 'active'", it would be more consistent and allow promise-based APIs to interact with IDB.

Currently, building an abstraction like this is impossible:

beginTransaction();
getValue('foo').then(function(val) {
  console.log(val);
  return setValue(val)
});

Assuming `getValue` returns a compliant promise, `setValue` fails as the transaction is inactive.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/27

Received on Monday, 10 August 2015 16:57:26 UTC