So I guess this is also the reason for why e.g. Int32Array returns double 
instead of int?

Also, would it be possible / make sense to make CanvasRenderingContext2D 
and WebGLRenderingContext extend NativeObject?
Right now, as HTMLCanvasElement.getContext(String contextId) returns a 
NativeObject I have to do things like this when getting the context:

context_ = (CanvasRenderingContext2D) (Object) canvas.getContext("2d")

It works but it feels wrong. Or am I just missing something obvious?

On Monday, July 4, 2016 at 9:46:44 AM UTC+2, Goktug Gokdogan wrote:
>
> Elemental2 currently purely driven by the JavaScript extern files. So it 
> is not trivial. Maybe a later version could include some kind of type 
> extension.
> For now perhaps we can improve the generated code to use generics so you 
> don't need to cast but we cannot modify the API.
>
> On Sat, Jul 2, 2016 at 2:07 PM, Manuel Carrasco Moñino <man...@apache.org 
> <javascript:>> wrote:
>
>> 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 <javascript:>>) 
>> 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.ne...@gmail.com <javascript:>
>>> > 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 
>>>> <javascript:>.
>>>> 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 
>>> <javascript:>.
>>> 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 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAM28XAsU1UZgkh3cjG1HPkpRBJfaiEh631fq9WdS_RQg8Z_Leg%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAM28XAsU1UZgkh3cjG1HPkpRBJfaiEh631fq9WdS_RQg8Z_Leg%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/023e92c6-8f9f-41b4-8203-369b82499d7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to