Closure extern definition uses a union type here:
https://github.com/google/closure-compiler/blob/master/externs/browser/w3c_event.js#L34

So it accepts either EventListener interface or a function.

When we see a union type, we generate overloads for each type so Elemental
should provide overloads that includes both. And it seems like it does. If
not please let us know.

On Fri, Jul 1, 2016 at 3:39 AM, Jens <jens.nehlme...@gmail.com> wrote:

>
> Thanks, now makes sense. I get confused with the JsFunction JsType(native)
>> because elemental2 has some callbacks as JsFunction and others as
>> JsType(native), now an actual elemental2 question; what criteria is used to
>> apply JsFunction (ex. elemental2.Node.AddEventListenerCallback) instead of
>> JsType (ex. elemental2.JsType)?
>>
>
> I think its the result of definition of EventTarget.addEventListener():
>
> *listener - The object that receives a notification (an object that
> implements the Event
> <https://developer.mozilla.org/en-US/docs/Web/API/Event> interface) when an
> event of the specified type occurs. This must be an object implementing the
> EventListener
> <https://developer.mozilla.org/en-US/docs/Web/API/EventListener> interface,
> or simply a JavaScript function
> <https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Functions>.*
>
> The EventListener interface is a defined API and thus a @JsType(isNative =
> true) interface has been generated. But to conform to "or simply a
> JavaScript function" there is also an AddEventListenerCallback that is a
> @JsFunction. Not sure if this distinction has any real value, in a hand
> coded elemental2 I would have only created a @JsFunction interface
> EventListener
>
> -- J.
>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/73b36bdb-c496-4768-a221-21fe8b5a437c%40googlegroups.com
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/73b36bdb-c496-4768-a221-21fe8b5a437c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA0ZfCbS%2Bnwtre0QuAnhDdLYz%2B3LuzXqD3WqoWqK%3DFe%2BEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to