Created
April 18, 2017 08:01
-
-
Save think2011/ae2c17bb9f87211293faebba6f4bfebe to your computer and use it in GitHub Desktop.
scriptLoader.js
This file contains hidden or 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
/** | |
* 加载script | |
* @param src | |
* @returns {Promise} | |
*/ | |
function scriptLoader(src) { | |
return new Promise((resolve, reject) => { | |
let script = document.createElement('script') | |
script.src = src | |
script.onload = resolve | |
document.body.appendChild(script) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment