Created
August 13, 2019 09:16
-
-
Save codesorter2015/6a680a3841a1ec330bdb6c0cdbe44b58 to your computer and use it in GitHub Desktop.
Load Script Using Java Script
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 loadScript(src) { | |
return new Promise((resolve, reject) => { | |
const script = document.createElement('script'); | |
script.src = src; | |
script.onload = resolve; | |
script.onerror = reject; | |
document.head.appendChild(script); | |
}); | |
} | |
loadScript('./load.js') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment