<script src="js-url"><![CDATA[ script ready-function body ]]></script>where ready-function body is the body of a JavaScript function that returns
true
when the script is loaded and is ready
for use. The script is loaded into the namespace of the
host page as if you had
included it explicitly using the HTML <script>
element.
For example, suppose your module relies on a script called
InjectedScript.js
that looks like this:
function foo() { // do something neat } doSomethingTimeConsuming(); function bar() { // do something else neat }Your module might look like this:
<module> <inherits name="com.google.gwt.user.User"/> <script src="InjectedScript.js"><![CDATA[ // More complex tests are possible, but usually checking for the existence // of a function is enough. if ($wnd.bar) return true; else return false; ]]></script> </module>
The purpose of the ready-function is to determine unambiguously that
the script is fully loaded, so that your GWT code can use
JSNI and be sure the
referenced identifiers are available. In the example above, the
existence of the function bar
indicates that the script
is ready.
<stylesheet src="css-url"/>You can add any number of stylesheets this way, and the order of inclusion into the page reflects the order in which the elements appear in your module XML.