Create a native JsType (isNative=true) named Promise with namespace set to
GLOBAL and define both constructors. It should work.
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class Promise {
public Promise(PromiseFn fn){};
}
On Mon, Nov 9, 2015 at 2:57 PM Cristian Rinaldi <[email protected]> wrote:
> Goktug:
> Nice Work!!!!!!
>
> How can we handle constructors of native types that receive parameters?
> By Example Promise in JS:
>
>
> new Promise(*executor*);
> new Promise(function(resolve, reject) { ... });
>
>
> I resolve with a static method and JSNI:
>
> public final static native Promise createPromise(PromiseFn fn) /*-{
> return new $wnd.Promise(fn);
> }-*/;
>
> @FunctionalInterface
> @JsFunction
> public interface PromiseFn {
> void call(ResolveFn resolve, RejectedFn rejected);
> }
>
> @FunctionalInterface
> @JsFunction
> public interface RejectedFn {
> void rejected(Object objs);
> }
>
>
> @FunctionalInterface
> @JsFunction
> public interface ResolveFn {
> void resolve(Object objs);
> }
>
> There is a more correct way to do this?
>
>
> El viernes, 23 de octubre de 2015, 4:13:55 (UTC-3), Goktug Gokdogan
> escribió:
>>
>> As we are getting close to 2.8 release I wrote a new document that is
>> concentrating on jsinterop features to be released in 2.8:
>>
>> https://docs.google.com/document/d/10fmlEYIHcyead_4R1S5wKGs1t2I7Fnp_PaNaa7XTEk0/edit#
>>
>> Please share your feedback.
>>
>> Thanks,
>>
>> Goktug
>>
> --
> 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/bd13754e-f451-4de9-a763-50b571762909%40googlegroups.com
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/bd13754e-f451-4de9-a763-50b571762909%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/CABb_3%3D5ORSsuxYPMi8ZXOwSafFb8BRVXaTbUtkt00tySnY5XUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.