Le 12/10/2011 15:38, David Bruant a écrit :
> (...)
>
> _Future work_
> 1) see how to deal with inherited events
So, I've been working on that. Updated code at
https://github.com/DavidBruant/HarmonyProxyLab/tree/master/EventedObject
(index2.html for test case).

Interestingly, in order to be able to implement inheritance, I used the
receiver argument of the get trap. I know that it was very close to
being removed completely [1], and that Firefox is incorrectly (according
to the ES5 definition of [[Get]]) calling the get trap on the prototype
but I'd like to argue to keep the receiver argument (exact traps to be
defined though).

As can be seen in my get trap, I use the 'receiver' argument for binding
the event. I actually do not see any other way to implement it. I don't
see a way for the event to know what to bind to when firing if the
receiver isn't passed to a trap of the event when this one is on the
prototype of the receiver.

I'm not sure which trap should have this argument. I have showed one use
case, but maybe others would need the receiver with the
getPropertyDescriptor trap call recursively?
To all traps related to inheritance?

David

[1] http://wiki.ecmascript.org/doku.php?id=strawman:proxy_drop_receiver
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to