mirror of
https://github.com/Eugeny/tabby.git
synced 2025-01-03 08:04:02 +03:00
web preload progress callback
This commit is contained in:
parent
d8a8d41614
commit
37e564130e
@ -69,15 +69,18 @@ const Tabby = {
|
|||||||
Tabby.registerPluginModule(info.name, module)
|
Tabby.registerPluginModule(info.name, module)
|
||||||
return module
|
return module
|
||||||
},
|
},
|
||||||
loadPlugins: async (urls) => {
|
loadPlugins: async (urls, progressCallback) => {
|
||||||
const infos: any[] = await Promise.all(urls.map(Tabby.resolvePluginInfo))
|
const infos: any[] = await Promise.all(urls.map(Tabby.resolvePluginInfo))
|
||||||
|
progressCallback?.(0, 1)
|
||||||
await Promise.all(infos.map(x => prefetchURL(x.url)))
|
await Promise.all(infos.map(x => prefetchURL(x.url)))
|
||||||
const pluginModules = []
|
const pluginModules = []
|
||||||
for (const info of infos) {
|
for (const info of infos) {
|
||||||
const module = await webRequire(info.url)
|
const module = await webRequire(info.url)
|
||||||
Tabby.registerPluginModule(info.name, module)
|
Tabby.registerPluginModule(info.name, module)
|
||||||
pluginModules.push(module)
|
pluginModules.push(module)
|
||||||
|
progressCallback?.(infos.indexOf(info), infos.length)
|
||||||
}
|
}
|
||||||
|
progressCallback?.(1, 1)
|
||||||
return pluginModules
|
return pluginModules
|
||||||
},
|
},
|
||||||
bootstrap: (...args) => window['bootstrapTabby'](...args),
|
bootstrap: (...args) => window['bootstrapTabby'](...args),
|
||||||
|
Loading…
Reference in New Issue
Block a user