scriptloader/moduleloader for jQuery 1.5

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:

  1. (function(){
  2.       //btw. readyWait should be a function, not a public counter
  3.       jQuery.readyWait++;
  4.       jQuery.domReady(function(){
  5.             //implement new dom api
  6.             //...
  7.             //tell others, that we are ready
  8.             jQuery.ready(true);
  9.       });
  10. }();
Please let me know wether you like my idea.

regards
alex