onModuleLoad() - what is it in javascript

170 views
Skip to first unread message

dreamer

unread,
Sep 8, 2011, 6:31:36 AM9/8/11
to Google Web Toolkit
Hi,

I am trying to figureout, what "onModuleLoad()" becomes after gwt
compilation.
Basically to figure out the magic behind "onLoadModule".

All is well, java script gets loaded in head. But how on the earth any
function inside that script got
executed, are there any events, that Browser fires once script is
loaded?

I checked compiled code, here there suspects. I am not javascript
guru, can somebody throw some light on this.
" schooldistrict.nocache.js" is the main java script name for my GWT
app.
===================== here are three suspects =======
schooldistrict.onInjectionDone = function(){
scriptsDone = true;
$stats && $stats({moduleName:$intern_1, sessionId:$sessionId,
subSystem:$intern_2, evtGroup:$intern_51, millis:(new Date).getTime(),
type:$intern_9});
maybeStartModule();
}
-------------------------------------------------
schooldistrict.onScriptLoad = function(){
if (frameInjected) {
loadDone = true;
maybeStartModule();
}
}
-------------------------------------------------------------
var onBodyDoneTimerId = setInterval(function(){
if (/loaded|complete/.test($doc.readyState)) {
maybeInjectFrame();
onBodyDone();
}
}
, 50);
--------------------------------------

Global school district
http://schoolk12.appspot.com/

Alexandre Ardhuin

unread,
Sep 8, 2011, 9:00:36 AM9/8/11
to google-we...@googlegroups.com
Hi,

Although I can not find an up-to-date version of this file in 2.4 documentation, some informations on the bootstrap sequence are available at http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideBootstrap

Alexandre.

2011/9/8 dreamer <venugopal...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Ernesto Oltra

unread,
Sep 8, 2011, 2:55:10 PM9/8/11
to google-we...@googlegroups.com

Ernesto Oltra

unread,
Sep 8, 2011, 2:56:32 PM9/8/11
to google-we...@googlegroups.com
Oops, and try using the "Detailed" compilation mode, to be able to search "onModuleLoad" in the javascript file and then track it better when compiled in advance mode.

dreamer

unread,
Sep 8, 2011, 11:14:30 PM9/8/11
to Google Web Toolkit
seems 1.6 documentation is old, it is assuming main script is in body.

now it is in head tag.

In detailed compile file, there is call for compile like
"schooldistrict();".

Which is bootstrap javascript function for all script lets.

My guess is main script (function/object) is getting executed soon
after loading, which
in tern is injecting all script tags in body, which in tern rendering
body.

Global School District
http://schoolk12.appspot.com/

dreamer

unread,
Sep 9, 2011, 12:16:02 AM9/9/11
to Google Web Toolkit
Just for proof of concept, save the below two code segments as html
and js files
and launch html, it builds the body.

==== test.html==========
<html>
<head>
<title>This is test page sas</title>
<script type="text/javascript" language="javascript" src="test.js"></
script>

</head>
</html>
===========
=======test.js=======
function test(){
alert("Hello");
document.write("Hello");
}
test();
======================


On Sep 8, 8:14 pm, dreamer <venugopal.vasire...@gmail.com> wrote:
> seems 1.6 documentation is old, it is assuming main script is in body.
>
> now it is in head tag.
>
> In detailed compile file, there is call for compile like
> "schooldistrict();".
>
> Which is bootstrap javascript function for all script lets.
>
> My guess is main script (function/object) is getting executed soon
> after loading, which
> in tern is injecting all script tags in body, which in tern rendering
> body.
>
> Global School Districthttp://schoolk12.appspot.com/

dreamer

unread,
Sep 9, 2011, 10:30:26 AM9/9/11
to Google Web Toolkit
To answer my own question, looks like,

"onLoadModuleLoad()" - won't be converted into javascript as is.

It is a directive to "java->javascript" cross compiler telling what is
main script and how
rest of the scriptlets are to be arranged.

Global School District
http://schoolk12.appspot.com/


Reply all
Reply to author
Forward
0 new messages