let jsUrls = ['https://unpkg.com/litegraph.js@0.7.18/build/litegraph.js']
let styleUrls = ['https://unpkg.com/litegraph.js@0.7.18/css/litegraph.css']

await Promise.all(styleUrls.map((styleUrl) => loadStyle(styleUrl)))
await Promise.all(jsUrls.map((jsUrl) => loadJavascript(jsUrl)))
const loadJavascript = (jsUrl) => {
    return new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.type = 'text/javascript'
        script.onload = () => resolve('')
        script.onerror = (err) => reject(err)
        script.src = jsUrl
        document.body.appendChild(script)
    })
}

const loadStyle = (styleUrl) => {
    return new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = styleUrl
        link.onload = resolve
        link.onerror = reject
        document.body.appendChild(link)
    })
}
GitHub 加速计划 / vu / vue
83
16
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:5 个月前 )
9e887079 [skip ci] 3 个月前
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 7 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐