Gwt lazy loading

Is this possible in a large GWT project, load a piece of lazy JavaScript on the fly? Like lining.

PS: iframes is not a solution.

+5
source share
5 answers

Check out GWT.runAsync, as well as the Google I / O message below, which goes to lazy loading JavaScript in GWT projects.

+7
source

I think this is what you are looking for.

<body onload="onloadHandler();">
<script type="text/javascript">
function onloadHandler() {
    if (document.createElement && document.getElementsByTagName) {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = './test.js';
        var heads = document.getElementsByTagName('head');
        if (heads && heads[0]) {
            heads[0].appendChild(script);
        }
    }
}
function iAmReady(theName) {
   if ('undefined' != typeof window[theName]) {
       window[theName]();
   }
}
function test() {
   // stuff to do when test.js loads
}        
</script>

- test.js

iAmReady('test');

Firefox 2, Safari 3.1.2 Windows, IE 6 Opera 9.52. , .

, . appendChild(), , script, , script .

script, - .

0

GWT , Java, (, , ) , JavaScript. JavaScript , , JavaScript.

, JavaScript ?

0

GWT, , . , , , , .

, , Java, . , GWT , (.. ), , .

, , , , , .

, GWT , - ( ), .

0

GWT " " iPhone iPod touch... .

, .

, Java iFrame?

  • Erick
0
source

All Articles