IntroductionSometimes you just change your mind in the middle of an action. Now gwt-hermes gives you ability to cancel ongoing requests and move forward! DetailsJust change returned type from void to Cancellable in your async interface and call cancel method when you want to cancel the request. Cancellable currentCall = testService.testMethod("aaaa", new AsyncCallback() {
public void onFailure(Throwable caught) {
Window.alert(caught.toString());
}
public void onSuccess(Object result) {
/* do something here */
}
});
//we change our minds here
currentCall.cancel();
|