Skip to content

Instantly share code, notes, and snippets.

@ngryman
ngryman / parallel.js
Last active February 1, 2018 10:11
jQuery parallel script loading keeping execution order.
/**
* Load scripts in parallel keeping execution order.
* @param {array} An array of script urls. They will parsed in the order of the array.
* @returns {$.Deferred}
*/
function getScripts(scripts) {
var xhrs = scripts.map(function(url) {
return $.ajax({
url: url,
dataType: 'text',