Thursday, September 2, 2010

Howto access instance method from external JavaScript?

Hello,

I am looking for a way to post to my event bus via user defined
javascript.

This is what I came up with, but the event is not fired. What's wrong?

// I call this during onModuleLoad
public native void registerExternalEventSink() /*-{
$wnd.fireExternalEvent =
this.@org.test.Gwt_platform_client::fireExternalEvent(Ljava/lang/
String;);
}-*/;


private void fireExternalEvent(String eventData) {
SomeEvent.fire(ginjector.getEventBus(), eventData);
}

js call:

fireExternalEvent("mydata"); // event is not triggered

Thanks for your input!

Kai

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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