Javascript asynchronously: one will never know whether the actual script has been loaded. What we need is either of the following two:
In practice this is not quite true. The
can only imagine a synchronous XMLHTTPRequest object to load other scripts, but how to process the script from that?
eval(). I thought about that, but it might slow things down considerably, as I'm not sure the browser cacheing works with XMLHTTPRequest as well as it does with <script> tags.
- 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.
We could patch the onLoad script handling. But the problem arises even before addOnLoad hook. For example when registering JSConfig keys (those can be used to determine whether the page gets included in the first place)