|
RunAsync
RunAsync overview
Introduction@RunAsync is another extension of the event binding system. It gets your handler called with GWT.runAsync. This way you can get granular control over the code splitting. Another way to split your code is making your places @RunAsync (see PlaceManager). Example: @ViewHandler
@RunAsync // Simply adding this will get this whole method async
protected void deleteButton$click() {
List<ContactDetails> selectedContacts = selectionModel.getSelectedItems();
int size = selectedContacts.size();
String[] ids = new String[size];
for (int i = 0; i < size; ++i) {
ids[i] = selectedContacts.get(i).getId();
}
commandService.execute(new DeleteContactAction(ids), new AbstractAsyncCallback<DeleteContactResponse>() {
@Override
public void success(DeleteContactResponse result) {
contactDetails = result.getContacts();
sortContactDetails();
view.setRowData(contactDetails);
}
});
}
| |