Best practice for using values returned in callbacks (RequestFactory)
In GWT and particularly the RequestFactory framework many callbacks are used to retrieve certain values
void callBack(final Integer userId) {
final MainRequestFactory.ResourceRequest reqFactory = mainRequestFactory.resourceRequest();
final com.google.web.bindery.requestfactory.shared.Request<Integer> req = reqFactory.getUserResourceId(userId);
req.fire(new Receiver<Integer>() {
@Override
public void onSuccess(final Integer response) {
System.out.println("My VALUE I want to return or assign to globally accessible variable = " + response); // MyValue
}
});
}
However I cannot neither return MyValue or assign it to a (even static) field because the callBack is asynchronous.
What is the best (a good one is fine enough too :) practice to process MyValue?
-- 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/-/2GExHWqNpccJ.
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home