Reputation: 3704
I was looking all around the samples but still can't get it... How to write such kind of function in JSNI as
function test(a)
{
return a+' is parameter';
}
I mean to be able get JS function return value with GWT... ?
All useful comments are appreciated
Upvotes: 0
Views: 3458
Reputation: 1866
Use JsArrayString
if you wish to return an array of the string.
This is helpful to overcome the following exception:
java.lang.ClassCastException: com.google.gwt.core.client.JavaScriptObject$ cannot be cast to [Ljava.lang.String;
Upvotes: 0
Reputation: 17489
JSNI function calls are defined like that:
public final native String test(String a) /*-{
return a + 'is parameter;
}-*/;
The important part of the function signature is final native and the opening and closing brackets.
Fore more information on how to write and use JSNI see here.
If you have more complex return types also check out JavaScript Overlays Types.
Upvotes: 3