Thursday, April 22, 2021

Re: [jsinterop] constructor reference

After some experiments, I figured out that option -generateJsInteropExports is required to make the code work. 

четвер, 22 квітня 2021 р. о 14:23:51 UTC+2 pavel....@gmail.com пише:
Hi,

I'm trying to get a reference on the constructor of the @JsType class but all the time receive undefined.

So, I need some suggestion where to look
My code is
public void onModuleLoad() {
    DomGlobal.alert(toCtor(Hello.class));
}

@JsType
public static class Hello {}

public static native JsConstructorFn toCtor(Class clazz) /*-{
    return clazz.@java.lang.Class::jsConstructor;
}-*/;

and config
<inherits name='com.google.gwt.user.User' />
<inherits name="elemental2.dom.Dom"/>
<inherits name="elemental2.core.Core"/>

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/2e1f3e7b-d355-430b-bd48-8b830907f544n%40googlegroups.com.

No comments:

Post a Comment