Re: InedxedDB events : misconception?

On 4/22/13 1:31 PM, Tab Atkins Jr. wrote:
>> Is there a reason to not pass the success/error/upgradeneeded callbacks in a
>> dictionary to open() in this case, so that the request object is born with
>> the right bits and the actual reques it not kicked off until _after_ the
>> side-effects of getting them off the dictionary have fully run to
>> completion?
>
> Dunno, ask sicking.  But events do have some benefits over passed callbacks.

I don't understand the distinction.

My straw-man proposal here is just that there is a dictionary with the 
three callbacks and then the return value has its 
onsuccess/onerror/onupgradeneeded set to those three callbacks before 
the actual request is kicked off and the request object is returned.

> (The right answer is to figure out some way to accommodate IDB's
> locking semantics in a future.  sicking and annevk have some
> discussion on this.  Then there's no possibility of event races,
> because your callback will still be fired even if you lose the race.)

That would be good, yes.

> Synchronously spinning the event loop is the devil. :/

Well, yes.  ;)

-Boris

Received on Monday, 22 April 2013 17:37:30 UTC