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
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to