const loadScript = url => new Promise((resolve, reject) => {
const node = document.createElement('script')
node.setAttribute('src', url)
node.onload = resolve
node.reject = reject
document.body.appendChild(node)
})
loadScript('//cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js')
.then(() => {
// do your job here
console.log(window.Cookies)
})
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…