Re: Indexed DB + Promises

Very good initiative.

Joshua, I am trying to understand how your proposal relates to
microtasks. Does the extension of lifetime mean that a transaction is
alive 1/ until the end of the event (including pending microtasks) or 2/
that it can be kept alive across several events?

Intuitively, I believe that only 1/ makes sense, but this may play
poorly with older implementations of `Promise` which don't use
microtasks – and which may end up injected accidentally in a webpage by
the use of a framework. I understand you reject with a `TypeError` if we
attempt to use such a `Promise` after the end of its the lifetime, which
might be sufficient, but you'll have to make sure that the companion
error message is very clear.

Cheers,
 David

On 28/09/15 19:43, Joshua Bell wrote:
> One of the top requests[1] we've received for future iterations of
> Indexed DB is integration with ES Promises. While this initially seems
> straightforward ("aren't requests just promises?") the devil is in the
> details - events vs. microtasks, exceptions vs. rejections, automatic
> commits, etc.
> 
> After some noodling and some very helpful initial feedback, I've got
> what I think is a minimal proposal for incrementally evolving (i.e. not
> replacing) the Indexed DB API with some promise-friendly affordances,
> written up here:
> 
> https://github.com/inexorabletash/indexeddb-promises
> 
> I'd appreciate feedback from the WebApps community either here or in
> that repo's issue tracker.
> 
> [1] https://www.w3.org/2008/webapps/wiki/IndexedDatabaseFeatures
> 


-- 
David Rajchenbach-Teller, PhD
 Performance Team, Mozilla

Received on Wednesday, 30 September 2015 07:14:28 UTC