Re: Should I use Code Splitting for my HeaderPresenter in GWTP?
On Sunday, October 13, 2013 12:06:28 AM UTC+11, Jens wrote:
1st, Will the webapp download all the Gui of MyDialogBox when user comes to page Header?Yes, if the page header is behind a split point. Otherwise the code has already been downloaded while downloading your app the first time.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)
All that matters is that your web server that serves your GWT app provides correct HTTP caching headers for GWT files that contain ".cache." (cache forever) and ".nocache." (never cache) in its name. Once you have configured that correctly the browser will not reload anything (because all files that contain app code have ".cache." in their file names) until you change something in your app and recompile/redeploy it.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
Not fully correct, but mostly. Only code that is unique to that split point will be downloaded. Other code that is not unique has already been downloaded by GWT during app download. This non-unique code is part of the so called "left over fragment". Because of this its likely that your split point is probably smaller than you think. You should always use the "story of your compile" feature of GWT when working with split points to get an HTML report that provides a lot of information to help understand whats going on.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?
Honestly I am not sure what GWT does if you hit the button a second time while the download is not yet completed. But I think GWT will handle it and do not do a second request. Once the split point is downloaded GWT won't fetch it again. And if your cache configuration in your web server is correct GWT will not fetch that code again even if you closed the browser because the code will be cached by the browser.However if your split point is really large and may take some time to download then you should give some sort of feedback while downloading that split point, e.g.button.addClickHandler(.....void onClick(...) {notifier.showMessage("Downloading app module..."); GWT.runAsync(....void onSuccess(...) {notifier.clearMessage();//show dialog}...)}...)Also, is it worthy to do code splitting for big DialogBox?
Use the compile report mentioned above to answer this question. It will tell you how much code is put into your split point. also be aware that if it says "300kb" or so, that a browser will download a lot less if gzip compression is enabled on your web server.-- J.
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home