naaa, "event" is just a placeholder ... most likely is gonna be var event = "@__event__" + Math.random();
and most likely that code should be on top with all other native prototypes shims or improvements. the correct this is bound as expected, the click function will have this === object indeed When I wrote any sort of object, i implicity meant any that inherits from Object.prototype ... are other "objects" ? I don't think so ... I would never do something like alert.on.alert(callback); you know what I mean ;-) br P.S. I just pressed reply but I think I removed your text through selection ... apologies On Sat, Oct 15, 2011 at 7:44 PM, David Bruant <bruan...@gmail.com> wrote: > Le 15/10/2011 18:26, Andrea Giammarchi a écrit : > > something like this ? ... > > My email client says that you're responding to my initial message, but you > may as well be responding to my concern about |this| binding. > I'll assume the former. > > > (...) > > gisted already: https://gist.github.com/1289809 > > best regards > > Unfortunately, it doesn't work with "any sort of object". It works with > objects inheriting from Object.prototype and which do not have an own 'on' > property (which would shadow yours) or an own 'event' property (because you > create one). > > As I stated in my initial e-mail, my goal was to support having the ability > to list events in order to potentially have doc and IDE support or at least > analysis. I agree that you could easily support enumeration of events (with > the getOwnPropertyNames trap for your "event" property), but it would > require actually running the code (JavaScript static analysis or rather > abstract interpretation is very hard, but I haven't even started to think > about how proxies makes this even harder!) > Unlike if you can just (semi-)syntactically declare that your property is > an event with the event attribute of the property descriptor or with an > addition to the object literal syntax as Erik suggested. > > Thanks, > > David >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss