There's no Code Splitting option When I create PresenterWidget in Eclipse,
so I assume that my PresenterWidget or DialogBox (that is initiated in
HeaderPresenter) will be downloaded at the time the HeaderPresenter is
called. Let see this code in HeaderPresenter:
Button b = new Button("Click me", new ClickHandler() {
public void onClick(ClickEvent event) {
MyDialogBox myD=new MyDialogBox(); ///There a lot of Gui (button, grid,
css...) on this dialogbox
myD.show();
}
});
So, my first question is:
1st, Will the webapp download all the Gui of MyDialogBox when user comes to
page Header?
2nd, Suppose users come to page Header second time on the same browser &
also the SAME session, then will the webapp download all the Gui of
MyDialogBox? (if it is on the same session, then i believe it won't
download again since the Gui got Catch elsewhere)
Ok, now I will put this Code Splitting as suggested by Google
http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html, as
following:
Button b = new Button("Click me", new ClickHandler() {
public void onClick(ClickEvent event) {
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught) {
Window.alert("Code download failed");
}
public void onSuccess() {
MyDialogBox myD=new MyDialogBox(); ///There a lot of Gui (button, grid,
css...) on this dialogbox
myD.show();
}
});
}
});
My assumption is that the Webapp will not download this code whenever user
visits Header page. But it will download the code on when users click the
button "b". But my question is that
If you click the button first time, then it will download, but what if user
clicks the same button 2nd time or even 3rd time, then will the app
continue to download the same gui of dialogbox in 2nd/3rd time? or Will the
app catch the gui of the dialogbox elsewhere when it downloaded 1st time &
when user clicks 2nd/3rd time it will recall the catch rather than
downloading the same things again?
I am confused, can anyone clarify?
Also, is it worthy to do code splitting for big DialogBox?
--
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.
For more options, visit https://groups.google.com/groups/opt_out.