Christof Donat wrote:
> 
> You can have that a lot cheaper. How about this:
> 
> jQuery.getScripts = function(scripts,callback) {
>       if( scripts.length == 0 ) {
>               callback();
>               return;
>       }
>       jQuery.getScript(scripts[0],function() {
>               jQuery.getScripts(scripts.slice(1),callback);
>       });
> }
> 

Ah recursion, what a beautiful thing! I like it.

But I don't understand the drawback. If the loaded scripts are evaluated as
soon as they are loaded, before calling the callback in $.getScript AFAIK,
there should be no problem, except that getScript does not support library
registration, so there is a risk for looping indefinitely.

-- 
View this message in context: 
http://www.nabble.com/Working-on-a-getScripts-plugin-tf2696465.html#a7520846
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to