GWT asynchronous loader now in trunk
Back from blogging hiatus. Rejoice my fellow geeks! Asynchronous java(script) loading is now part of GWT trunk – post 1.6 it seems. The r3901 merge has done it, and you can now fearlessly start hacking your way through this very early, although looking pretty mature feature. It’s now time to whip out all all of your 1Mb+ GWT modules and break them apart into a thousand 1K pieces
what does the code look like you might ask? Here you go:
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
public void onSuccess() {
callback.onSuccess(onInitialize());
}
});
where onInitialize() can have whatever your complex nature desires.
Haven’t tried this particular build yet, but looking forward to, in a few days.
Related posts:
- GWT is going non-monolithic (runAsync) There have been many discussions on GWT forums about the...
Quite a complicated example… (and what’s ‘callback’ coming from?)
Why not just present it as:
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
// do whatever your complex nature desires
}
public void onFailure(Throwable caught) {
// failed to load additional code
}
});
So now you can lazily initialize your app behind your “login screen” with the latter initializing faster than ever!