I'm working on a GWT application and I would like to make that app listen for external custom Javascript events. Those events would be triggered from outside my module.
Basically, just like what you would do in a basic web app with some jQuery :
$('#foo').bind('customEvent', function() {
...
});
...
$('#foo').trigger('customEvent');
I tried to achieve this with GWTQuery by overriding the onAttach
method in my Composite:
@Override
protected void onAttach() {
super.onAttach();
$("#mainView").bind("refreshSheet", new Function() {
public boolean f(Event e) {
refreshSheet();
return true;
}
});
}
This is not working, the callback function is being called while I haven't triggered the event on the other side.
What would you suggest to achieve this goal ?