[jsinterop] constructor reference

48 views
Skip to first unread message

pavel....@gmail.com

unread,
Apr 22, 2021, 8:23:51 AMApr 22
to GWT Users
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"/>

pavel....@gmail.com

unread,
Apr 22, 2021, 5:20:32 PMApr 22
to GWT Users
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 пише:
Reply all
Reply to author
Forward
0 new messages