Reading the GWT Bootstrap on Googles page, i have some question. (http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/FAQ_WhenDoModulesLoad )
Assumptions: Most browsers will allow a maximum of two simultaneous connections for fetching resources.
The HTML Page:
<html>
<body onload='alert("w00t!")'>
<img src='bigImageZero.jpg'></img>
<script source='externalScriptZero.js'></script>
<img src='bigImageOne.jpg'></img>
<img src='reallyBigImageTwo.jpg'></img>
<script src='com.example.app.App.nocache.js'></script>
<script src='externalScriptOne.js'></script>
</body>
</html>
So , the bootstrap is composed of:
- The HTML document is fetched and parsing begins.
- Begin fetching bigImageZero.jpg.
- Begin fetching externalScriptZero.js.
- bigImageZero.jpg completes (let's assume). Parsing is blocked until externalScriptZero.js is done fetching and evaluating.
- externalScriptZero.js completes.
- Begin fetching bigImageOne.jpg and reallyBigImageTwo.jpg simultaneously.
- bigImageOne.jpg completes (let's assume again). com.example.app.App.nocache.js begins fetching and evaluating.
- ...nocache.js completes, and the compiled script (...cache.js) begins fetching (this is non-blocking).
- ...cache.js completes. onModuleLoad() is not called yet, as we're still waiting on externalScriptOne.js to complete before the document is considered 'ready'.
- externalScriptOne.js completes. The document is ready, so onModuleLoad() fires.
- reallyBigImageTwo.jpg completes.
body.onload() fires, in this case showing an alert() box.
The question:
how the JAVASCRIPT knows that the document is ready to begin onModuleLoad function ( step 10 ) ?