Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
scriptLoader.js
/**
* 加载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