Quick answer is: If you're providing a series of APIs to a third
party, you:
1) Don't want to give them the source code to recompile them
(potentially).
2) Don't want to make their life difficult by forcing them to
recompile.
3) Don't want to step outside of what is 'normal' for a JS library (no
extra custom ready functions...)
I understand what you're saying; yes, linking it all together is more
efficient. Yes, you can bind everything together that way and you
don't need multiple ready functions. Its a great way of building a
rich net app.
However, for JS mashups, you don't want a single page application that
does everything. You want something that compiles into a generic
robust usable JS API, that is easy to use and obviously interact with
other JS APIs.
Incidentally, as I mentioned, the javascript isn't being loaded in an
iframe. I'm compiling in xs (cross site scripting) mode, which means
the JS is added as an inline element in the head. The google code
launcher specifically waits until after everything else before it
launches itself (I presume to ensure the DOM is ready before kicking
off the application init), but I would have been pleased if maybe the
module constructor was run on load, and only onModuleLoad waited until
after body.onload was called. Oh well.
I've come to realize that GWT is ill suited to what I'm doing. I'm
quite disappointed really.
~
Doug.
On Aug 9, 3:02 am, David <
david.no...@gmail.com> wrote:
> I'm not 100% following your question, so excuse me if my answer does
> not match your question.
>
> Why would you need to have a toBeCalledByGWT for every method you want
> to expose from GWT ?
>
> I presume you have created an API in GWT and want to expose it outside of GWT ?
> Just make sure that the onModuleLoad exposes all the methods (one way
> or another) and at the end you just call one method on the window
> object to indicate that the API is ready to be used. So you JS code
> just needs to wait until that method is invoked before starting
>
> If you want to use multiple GWT APIs this way, I guess the best thing
> to do is to have one onModuleLoad that invokes the injection of all
> the APIs in JS and then call one callback to kickstart your
> application. The idea of GWT is that you compile everything in one
> application to improve optimisations and to have a small as possible
> JS.
>
> Why is the GWT API not fully initialized ? Well because it is
> actually loaded by a hidden IFrame. Additionally with GWT 2.0 we will
> be able to actually load parts on demand through runAsync support.
>
> David
>