void asyncMethod(final Callback<SuccessType, FailureType> callback) {
//Some async work, could also be a simple Timer task or similar that
only runs on the client.
rpcservice.getData(new AsyncCallback<String, Throwable> {
void onSuccess(String result) {
//Do what you need to do
....
if(callback != null) { callback.onSuccess(..); } //notify caller
via callback
}
void onFailure(Throwable cause) {
//Do what you need to do
....
if(callback != null) { callback.onFailure(..); } //notify caller
via callback
}
}
}
void otherMethod() {
asyncMethod(new Callback<SuccessType, FailureType>() {
//implement what you want to do when asyncMethod returns and calls
the callback.
});
}
SuccessType and FailureType can by anything including Void if you don't
care about information and just want to be notified.
-- J.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.