One of the problems is that the document.write call loads the
Javascript asynchronously: one will never know whether the actual
script has been loaded. What we need is either of the following two:
- Synchronous script loading. I don't know whether this is possible. I
can only imagine a synchronous XMLHTTPRequest object to load other
scripts, but how to process the script from that?
- Another event system. Scripts should call a hook, which takes a
function as parameter, similar to addOnloadHook. This function will
then be called once all dependecies have been loaded.
Bryan