Re: [IndexedDB] Events and requests

On 11/9/2010 12:35 AM, Jonas Sicking wrote:
> One thing we could do is to move
>
> .source
> .transaction
> .result
> .error
>
> to IDBRequest. Then make "success" and "error" events be simple events
> which only implement the Event interface. I.e. we could get rid of the
> IDBEvent, IDBSuccessEvent, IDBTransactionEvent and IDBErrorEvent
> interfaces.
>
> We'd still have to keep IDBVersionChangeEvent, but it can inherit
> Event directly.
>
> The request created from IDBFactory.open would return a IDBRequest
> where .transaction and .source is null. We already fire a IDBEvent
> where .source is null (actually, the spec currently doesn't define
> what the source should be I see now).
This seems fine to me.

> db.transaction(["foo"]).objectStore("foo").get(mykey).onsuccess = function(e) {
>    alert(e.result);
> }
>
> would turn into the slightly more verbose
>
> db.transaction(["foo"]).objectStore("foo").get(mykey).onsuccess = function(e) {
>    alert(e.target.result);
> }
The only difference is e.result vs e.target.result, right?  I'm not sure 
we should worry about that little bit (and consumers can always use a 
local variable for that if it bothers them).

Cheers,

Shawn

Received on Wednesday, 10 November 2010 18:39:31 UTC