Hi all,
I run into a problem using a JavaScript Charting library which is
based on Prototype. The requirement is that prototype.js is loaded
before the charting library.
I could solve this by adding script tags to my host page in the proper
order but I would like to distribute the library as GWT module. So
this is not a solution.
If I reference the scripts from my gwt.xml file, I do not get a
defined order of loading. The first script is by far larger and
appears after the second, which leads to a JavaScript exception.
<module>
<inherits name='com.google.gwt.user.User'/>
<script src="loadMeFirst.js"/>
<script src="loadMeSecond.js"/>
</module>
Another work around I found is to load the scripts with synchronyous
calls in the widget constructor.
private native void initJs(String moduleBase) /*-{
$wnd.console.log("modulebase="+moduleBase);
var js = ["loadMeFirst.js", "loadMeSecond.js"];
for(var i = 0; i< js.length; i++){
var scriptName = moduleBase+"protochart/"+js[i];
var req = new XMLHttpRequest();
req.open('GET', scriptName, false);
req.send(null);
if(req.status == 200)
eval(req.responseText);
else
$wnd.console.log("Loading failed "
+req.status);
}
}-*/;
Is there any more GWT like approach to this?
Best Regards
Sebastian Hennebrueder
http://www.laliluna.de
--
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.