Last active
December 4, 2015 15:29
-
-
Save brianswisher/0d9e283977314ce4a9c1 to your computer and use it in GitHub Desktop.
Dynamic script loader
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
(() => { | |
const libs = [ | |
"https://cdnjs.cloudflare.com/ajax/libs/superagent/1.2.0/superagent.min.js", | |
"https://cdnjs.cloudflare.com/ajax/libs/ramda/0.18.0/ramda.min.js" | |
].map((src) => { | |
return new Promise(resolve => { | |
const script = document.createElement("script"); | |
script.src = src; | |
script.async = false; | |
script.onload = () => { | |
resolve(); | |
}; | |
document.head.appendChild(script); | |
}); | |
}); | |
return Promise.all(libs).then(() => { | |
console.log(superagent, R); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment