There have been many discussions on GWT forums about the monolithic nature of javascript produced by GWT’s java-to-javascript compiler (typical GWT compilation output consists of a single .js file produced for every major browser). Although this certainly is a tried-and-true approach in GWT for improving performance, many developers of large GWT-based projects would like to have the flexibility to partition their applications and load their parts dynamically at runtime. It looks like Google WebToolkit team is making great progress in implementing this exact functionality in a future release. I noticed this branch (called runAsync) within GWT trunk. And here is sneak peak at how it may look like in the code:
AsyncCallback<MyBigCompositeWidet> callback= new AsyncCallback<MyBigCompositeWidet>() {
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
public void onSuccess(MyBigCompositeWidet result) {
result.setVisible(false);
}
};
GWT.createAsync(MyBigCompositeWidet.class, callback)
Pretty Slick!
Filed under: compiler | Tagged: compiler | 1 Comment »