JSFiddle - React, Tailwind, and code Playground
JavaScript
var getAllScripts = function (scripts, callback) {
var i, count = scripts.length;
// Start loading all files
for (i = 0; i < scripts.length; i += 1) {
$.getScript(scripts[i], function () {
// When loaded, decrease count
count -= 1;
// If all is loaded, call the callbacl
if (count === 0) {
callback();
}
});
};
};
getAllScripts([
'http://cdnjs.cloudflare.com/ajax/libs/Chart.js/0.2.0/Chart.js',
'http://cdnjs.cloudflare.com/ajax/libs/angular-moment/0.6.2/angular-moment.js',
'http://code.jquery.com/jquery-1.11.0.js'
],
// Here all files is loaded
function () {
alert('All is loaded');
}
);