Monday, June 4, 2012

GWT JSNI Callback

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.
 2. I don't know if such an assignment is advisable from the perspective of JSNI functionality
 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"

public static interface JavaCallback {
void execute(JavaScriptObject jsObject);
public static class JsCallback extends JavaScriptObject {
public final JavaCallback callback;
public JsCallback(JavaCallback callback){
this.callback = callback;
init();
}
private native void init()/*-{
this.@com.roamtopix.client.StaticFacad.JsCallback::that(Lcom/google/gwt/core/client/JavaScriptObject;)(this);
}-*/;
private native void that(JavaScriptObject that)/*-{
var fn = function(jsObject) { 
this.@com.roamtopix.client.StaticFacad.JsCallback::callback.execute(Lcom/google/gwt/core/client/JavaScriptObject;)(jsObject);
};
that = $entry(fn);
}-*/;
}


--
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/-/O_buDgbx1PYJ.
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