On Thu, Feb 19, 2009 at 2:18 PM, Dave Schweisguth <[email protected]> wrote: > > Hi Eric! Thanks for your suggestions. I think you're on to something > -- that is, because an error turns up in map code, it seems like > something is happening concurrently that shouldn't -- but I'm still > trying to work out what's going on. > > My understanding of the page-building process is that the browser > loads HTML until it hits an in-line script, stops everything until the > script has executed, and then resumes loading the regular HTML. This > is what happens with our various third-party scripts now. By the time > GWT loads, all of the third-party scripts should already have run (and > that's certainly what it looks like on the page and in Firebug).
That is what happens when you use document.write() or have the script included in your HTML before the body of the page has finished loading. > > Now, the change I'm trying to make is to move one of those script tags > to GWT. I'm not trying to call any functions defined by those scripts > myself, just to add them to the page and let them write HTML (or, in > at least one case, another script tag, which then writes HTML). I'd > expect all of that to happen in the single Javascript thread. Nope, in this case, the script is loaded asynchronously. The call to add the script element to the DOM returns immediately and your script will finish loading at some indeterminate time in the future (if at all). > As for the map, we are using the gwt-google-apis maps library. We > don't try to defer map creation, because we don't want to defer the > map; we want it first. > > So when I tried moving one of the scripts to onModuleLoad, the script > was probably trying to execute at the same time as map code (haven't > looked into the guts of the map, but there must be XHRs in there and > those can be concurrent) but it's not clear to me > > a) why the script had the result it did, of replacing the whole page > with the contents of executing the script > b) why it would bother the map (since they should have been working in > different divs) If you didn't do anything differently with the Maps code, I'm not sure why it didn't load. You should be able to load the Maps API with other scripts in parallel. > > Hope that might ring another bell for you. > > Now I'm starting to wonder whether I should wait for the map to finish > initializing, and how I might go about that. Not sure if the part of > the map API we're using now has any such notion. Possibly your loader > is the answer after all, since it can tell me when the map is done. > I'll be happy to hear any other thoughts in the meantime, though -- > I'm still unclear as to why my first solution didn't just work. > > Thanks! > > > -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
