james
james

Reputation: 2663

Sending Javascript to GWT JSNI

I know how to call Javascript from GWT.But I have a javascript function that returns a string so, how could I when that function is called send it to GWT.

Hope this makes sense

Upvotes: 0

Views: 338

Answers (1)

Jai
Jai

Reputation: 3609

This is how you collect strings from JSNI fn

public static native String stringExample() /*-{ return "String1"; }-*/;

This is how you pass a string to JSNI fn

public static native void alert(String msg) /*-{ $wnd.alert(msg); }-*/;

Hope this is what you were looking for.

Upvotes: 2

Related Questions