My understanding is that GWT.runAsync
is called any time you wish to implement "codesplitting" and trigger a new exclusive fragment to download.
My understanding is that it is recommended (by GWT) to design/develop functionality for a particular fragment in such a way that it can be downloaded once into a singleton instance of AsyncProvider
and reused again and again.
My questions are:
AsyncProvider
" style apply to models, views and presenters? In other words, do I have to code in such a way that Model/View/Presenter "MVP-1" doesn't reference code inside of Models/Views/Presenters "MVP-2", so that when an AsyncProvider
calls GWT.runAsync
and pulls down the fragment for MVP-1, its a nice, clean, dependency-free download? Or am I fundamentally misunderstanding the AsyncProvider
pattern altogether?AsyncProxy
and how does it fit in here?AsyncProvider
pattern to begin with?!?Thanks in advance!
Code Splitting and MVP are 2 differents things, it means that you don't need MVP for code splitting, but it's a very good thing to do with MVP.
Broadly speaking, a UI with GWT, it's lot of components (View/Presenter) put together, each component can be code with MVP or not. And when a component call an other component, you must use GWT.runAsync
, if you want to split your code.
So for the first question: yes, AsyncProvider
works with MVP.
For the others questions, I invite you to watch the Google I/O 2011 at 32:55, it's explained well.
Personaly I use and recommend Code Splitting with Places & Activities, see issue 5129