Hi,
I often export some of my gwt code as a Javascript library (using
timepedia exporter) so that my host page can use it as a 'simple' Js
library.
In the past I had issues waiting for the gwt module to load and I
always ended up writing a loop using setTimeout to wait for my gwt
module to startup.
Something like:
var loadCallbacks=[];
document.onload=gwtWait();
function gwtWait(){
if (typeof my_module== "undefined"){
setTimeout("gwtWait()", 500);
return;
}
for (i=0;i<loadCallbacks.length;i++){
loadCallbacks[i]();
}
}
loadCallbacks.push(function(){\
do_something with my module
}
I figured a way to modify the standard linker (IFrameLinker) to make
it accept callback function for when the module was loaded:
var funcHandler=[];
__MODULE_FUNC__.registerCallback=function (fName){
funcHandler.push(fName);
}
function notifyHandler(){
for (i=0;i<funcHandler.length;i++){
funcHandler[i]();
}
}
And in the function maybeStartModule() :
...
frameWnd.gwtOnLoad(onLoadErrorFunc, '__MODULE_NAME__', base);
notifyHandler();
So that in my host page I simply write:
my_module.registerCallback(function(){
...
}
Now I'm wondering:
Is this is the best way to do this?
Is there any way you guys could add something similar in the trunk?
It makes it easy to use gwt in a 'normal' html page
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---