Hi Jens,
Thanks for answering again :)
I just wonder - if this is intended, how should I then pass callback to JS functions? I was doing similar jQuery example as was presented on "Deep dive in JS Interop" persentation - https://www.youtube.com/watch?feature=player_embedded&v=-s4Wfnojh1Q#t=200 . My even simplified version. And this is failing. For me if the @JsFunction doesn't fully behave like a function, it doesn't fulfill the premise and the integration with JS will be a bit harder. I hope it is just not yet finished.
@JsType(prototype = "jQuery")public interface JQuery {JQuery css(String attr, String value);JQuery click(Callback callback);}
@JsFunctionpublic interface Callback {void callback();}
static native JQuery jquery(String selector) /*-{return $wnd.jQuery(selector);}-*/;
// ...jquery("button").click( () -> Window.alert("Click!") );
Marcin
On Thursday, 9 April 2015 13:45:00 UTC+2, Jens wrote:
Hmm not 100% sure but it looks intended.How the @JsFunction is implemented in the AST:How the Javascript function is generated that wraps the call to your @JsFunction Java SAM method:So you can see the generated javascript function is calling the SAM method by providing itself as "this" (using samMethod.call(lambda, ..) ) and the proto is set to the Foo instance that has the samMethod defined.-- J.
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment