-
-
Save liveme/7fc4c6999899edf3505e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($) { | |
'use strict'; | |
/** | |
* Multiple parallel getScript | |
* | |
* @access public | |
* @param Array|String url (one or more URLs) | |
* @param callback fn (oncomplete, optional) | |
* @returns void | |
*/ | |
var getScript = $.getScript; | |
$.getScript = function(url, fn) { | |
if(!$.isArray(url)) {//juggle type | |
url = [url]; | |
} | |
$.when.apply(null, $.map(url, getScript)).done(function() { | |
fn && fn(); | |
}); | |
}; | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment