I have the following function:
function require(url)
{
var e = document.createElement("script");
e.src = url;
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
}
Which allows to dynamically load javascript at runtime, and I need to add a callback after loading some new files
For example when I
require('className.js');
and just after this call
var a = new window[className];
file has not been loaded yet, so it generates an error.