I'm wondering if it would be possible to have type-safe convenience methods
for creating elements, so as the user does not have to provide the string
tag name, nor cast the object, maybe something like :

HTMLButtonElement button = HTMLButtonElement.createElement();

instead of

HTMLButtonElement button = (HTMLButtonElement)
document.createElement("button");



El sáb., 2 jul. 2016 a las 4:38, 'Goktug Gokdogan' via GWT Contributors (<
google-web-toolkit-contributors@googlegroups.com>) escribió:

> 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
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA0ZfCbS%2Bnwtre0QuAnhDdLYz%2B3LuzXqD3WqoWqK%3DFe%2BEg%40mail.gmail.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/CAM28XAsU1UZgkh3cjG1HPkpRBJfaiEh631fq9WdS_RQg8Z_Leg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to