scriptloader/moduleloader for jQuery 1.5
Is a scriptloader planned for jQuery 1.5? I think a scriptloader in jQuery core or at least an official plugin would be quite usefull.
I have written a scriptloader to start a new discussion about the required features. Here some features/options:
- everything is loaded async and simultaneous (performance)
- beside a simple callback-function you can also register "loaded"-events and if the eventhandler is bound after the script has loaded, the event handler is called immediatley
- global but simple FOUC prevention helper
- optional readyWait feature
Beside this, I think jQuery should add a new event like 'readomlready', wich is called if the DOM is ready no matter, if readyWait was incremmented by script. With this event you can write code like this:
- (function(){
- //btw. readyWait should be a function, not a public counter
- jQuery.readyWait++;
- jQuery.domReady(function(){
- //implement new dom api
- //...
- //tell others, that we are ready
- jQuery.ready(true);
- });
- }();
Please let me know wether you like my idea.
regards
alex