Corbett Tek schrieb am Donnerstag, 22. August 2024 um 15:57:31 UTC+2:
When transporting some of my previously jsni written code to jsinterop framework, I am facing problems when accessing java methods from javascript file.
For example in this jsni code I am accessing java method getOrCreateJsObj() and I need to convert this jsni code to jsinterop framework. How can I do this? What is the syntax for this? I tried official docs way, but it didn't worked out. Please help...
//the jsni method that I need to convert into jsinterop
private native void addWidgetListener(String event, JavaScriptObject fn) /*-{
var component = this.@org.lib.client.widgets.Component::getOrCreateJsObj()();
component.addListener(event, fn);
}-*/;
public JavaScriptObject getOrCreateJsObj() {
JavaScriptObject jsObj = getComponentJS(id);
if (jsObj != null) {
return jsObj;
} else {
return create(config);
}
}