I’m using GWT to create a client-side only library. I’m using JSNI to call functions is Java from JS. The issue is I’m trying to pass in an element or a function handler and nothing seems to be happening. I don’t get an exceptions from GWT or js. Here’s my JSNI function with the bridge.
public static String testMe(Object obj)
{
return "Response to " + obj.toString();
}
public static native void defineBridgeMethod() /*-{
$wnd.testMe = function(msg) {
return @com.mycompany.mywebapp.client.MyWebApp::testMe(Ljava/lang/Object;);
};
}-*/;
Thanks!
You’re not using
msg, do you mean to call the function with it as a parameter:or you can assign the function directly to window: