Tuesday, June 5, 2012

Re: GWT JSNI Callback



On Tuesday, June 5, 2012 3:42:36 AM UTC+2, zorro wrote:
I am trying to implement a callback using JSNI. 
 1. I don't know if changing "this" is allowed in the way I do it.

No.
BTW, you're not doing much.
 
 2. I don't know if such an assignment is advisable from the perspective of JSNI functionality

No.
 
 3. The compiler in Eclispe does not seem to grasp that as well and I don't know the right syntax 

for    this.@com.roamtopix.client.StaticFacad.JsCallback::callback.execute(Lcom/google/gwt/core/client/JavaScriptObject;)(jsObject); with "callback.execute" it says 
"JavaScript parsing: Missing ) after argument list"

for this.@com.roamtopix.client.StaticFacad.JsCallback::callback::execute(Lcom/google/gwt/core/client/JavaScriptObject;)(jsObject);with "callback::execute" it says
"JavaScript parsing: Invalid label"


var callback = this.@com.roamtopix.client.StaticFacad.JsCallback::callback;
callback.@com.roamtopix.client.StaticFacad.JavaCallback::execute(Lcom/google/gwt/core/client/JavaScriptObject;)(jsObject);

But there's simpler.
It depends how you (intend to) use your callback though.
Have a look at https://code.google.com/p/gwt-in-the-air/source/browse/trunk/src/net/ltgt/gwt/browserplus/core/client/BrowserPlus.java#145 (the createNativeCallback method) for a way of wrapping a Java callback into a JS function to be passed as a "callback" to some API.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/3RJnhZ4JhhoJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment