Skip to content

Commit

Permalink
5.23 #2
Browse files Browse the repository at this point in the history
  • Loading branch information
ltxhhz committed May 23, 2024
1 parent 6684f7e commit 245f27b
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions src/renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,26 +188,32 @@ jsdelivr镜像直接按默认那个写就行

const pluginListDom = view.querySelector('#plugin-list')!

const getList1 = (noCache = false) =>
getList(noCache).then(async list => {
pluginList = list
totalEl.innerText = list.length.toString()
const promArr: Promise<void>[] = []
const limit = pLimit(3)
list.forEach((plugin, i) => {
const dom = document.createElement('plugin-item') as PluginItemElement
pluginListDom.appendChild(dom)
promArr.push(
limit(async () => {
const manifest = await getManifest(plugin, noCache)
dom.dataset.index = i + ''
config.debug && console.log(plugin, manifest)
updateElProp(dom, manifest, plugin.repo)
})
)
const getList1 = (noCache = false) => {
refreshBtn.setAttribute('is-disabled', '')
getList(noCache)
.then(async list => {
pluginList = list
totalEl.innerText = list.length.toString()
const promArr: Promise<void>[] = []
const limit = pLimit(3)
list.forEach((plugin, i) => {
const dom = document.createElement('plugin-item') as PluginItemElement
pluginListDom.appendChild(dom)
promArr.push(
limit(async () => {
const manifest = await getManifest(plugin, noCache)
dom.dataset.index = i + ''
config.debug && console.log(plugin, manifest)
updateElProp(dom, manifest, plugin.repo)
})
)
})
return Promise.all(promArr)
})
return Promise.all(promArr)
})
.finally(() => {
refreshBtn.removeAttribute('is-disabled')
})
}

refreshBtn.addEventListener('click', () => {
pluginListDom.replaceChildren()
Expand Down

0 comments on commit 245f27b

Please sign in to comment.