Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
Created March 14, 2012 05:04
Show Gist options
  • Save tlrobinson/2034215 to your computer and use it in GitHub Desktop.
Save tlrobinson/2034215 to your computer and use it in GitHub Desktop.
function loadScript(url, callback) {
var script = document.body.appendChild(document.createElement("script"));
script.onload = callback;
script.src = url;
}
function loadScripts(scripts, callback) {
dependencies.reverse().reduce(function(next, url) {
return loadScript.bind(null, url, next);
}, callback)();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment