mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
refactor(docs): [SITE-03] migrate desktop editor and integrate typed generation
This commit is contained in:
1 parent
a468cb2c39
commit
2f130c58f1
37 files changed
+1921
-305
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { readPreference } from './editor-preferences.ts'
|
||||
|
||||
function loadScript(url: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const script = document.createElement('script')
|
||||
const clear = () => {
|
||||
script.onload = null
|
||||
script.onerror = null
|
||||
}
|
||||
script.onload = () => {
|
||||
clear()
|
||||
resolve()
|
||||
}
|
||||
script.onerror = () => {
|
||||
clear()
|
||||
script.remove()
|
||||
reject(new Error(`Editor bootstrap failed: ${url}`))
|
||||
}
|
||||
script.src = url
|
||||
document.body.appendChild(script)
|
||||
})
|
||||
}
|
||||
|
||||
async function bootstrap(): Promise<void> {
|
||||
await loadScript(
|
||||
readPreference('prod')
|
||||
? './compiled/artplayer.js'
|
||||
: './uncompiled/artplayer/index.js',
|
||||
)
|
||||
await loadScript('./assets/js/vs/loader.js')
|
||||
await loadScript('./assets/js/common.js')
|
||||
}
|
||||
|
||||
void bootstrap().catch(error => console.error(error))
|
||||
Reference in new issue
Block a user