Oh thanks! I'll try that.
Once I think we need to merge our work on those topics...
Thanks!

Le mar. 30 août 2016 16:06, Paul Stockley <[email protected]> a écrit :

> If you are passing  Resolver<T> into some function. You could instead
> create 3 Resolver interfaces and then overload the function so that it took
> each of the resolver interfaces.
>
>
> On Saturday, August 27, 2016 at 9:51:50 AM UTC-4, Arnaud TOURNIER wrote:
>>
>> Hi,
>>
>> I am playing with js Promises and maybe there's a problem with JsInterop
>> or i don't understand something.
>>
>> When wrapping the promises with JsInterop, i come to define the Resolver
>> interface which represents the resolving callback that is given when
>> constructing a promise. In Javascript it is a function and not an object,
>> so the interface has the @JsFunction annotation.
>>
>> Here is the Resolver interface (inspired from the TypeScript definition
>> of Promises...) :
>>
>> @JsFunction
>> @FunctionalInterface
>> public interface Resolver<T>
>> {
>> void resolve( T value );
>> }
>>
>> Since the Javascript "resolve" function can be called without parameters
>> and also with a Promise instead of a value, i would like to make those
>> versions available in the interface.
>>
>> But the @JsFunction annotation prevents from having this :
>>
>> @JsFunction
>> public interface Resolver<T>
>> {
>> void resolve();
>>
>> void resolve( T value );
>>
>> void resolve( Promise<T> value );
>> }
>>
>> That's because it allows only one method in the annotated interface.
>>
>> That is what i don't understand : AFAIK, the gwt compiler has to call the
>> same function in the same way for the three declared methods (because of
>> the semantic of the @JsFunction annotation), just changing the calling
>> parameters. So i don't understand why is there the limitation of having
>> only one method allowed in @JsFunction interfaces... If it would it would
>> give even much power to JsInterop !
>>
>> Could you please bring light to my misunderstanding ?
>>
>> Thanks !
>>
>> Arnaud
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "GWT Contributors" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-web-toolkit-contributors/pNmyrzkfPWo/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/a5ebf0e5-2e7f-40b9-ac82-a52c4b9ee5a6%40googlegroups.com
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/a5ebf0e5-2e7f-40b9-ac82-a52c4b9ee5a6%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CANjaDnd6AzYDRpzLdPFkpzw5j6To6BN-22NqPyQVyaB9ER%2B9hQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to