On Wednesday, July 10, 2013 6:55:18 AM UTC+2, Prabhu wrote:
>
> public static native void exportMyFunction(Gwtgooglechartsexample x)
> /*-{
> $wnd.callPopup
> =$entry([email protected]::callPopup()());
> }-*/;
>
This code is not doing what you thing it does: x.@…::callPopup()() calls
the method, then $entry() will wrap the returned value ('undefined' in this
case, as the method's return type is 'void') into a function which is
finally assigned to $wnd.callPopup. (note that the function returned by
$entry will throw because it'll try to call apply() on 'undefined').
You'll want to do:
$wnd.callPopup = $entry(function() {
[email protected]::callPopup()();
});
I.e. wrap a function that will call callPopup().
If callPopup were a static method, you could also do:
$wnd.callPopup =
$entry(@com.sample.client.Gwtgooglechartsexample::callPopup());
(note the single pair of parens: we get the reference of the method, which
is a JS function, and wrap it in $entry; this doesn't work for non-static
method because the method reference is not bound to the object, so the
'this' would be $wnd, not 'x')
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.