mirror of
https://github.com/lanyeeee/bilibili-video-downloader.git
synced 2026-09-09 09:36:46 +08:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1254c6bf2a | ||
|
|
9fe5cf0a45 | ||
|
|
b4b35f6055 | ||
|
|
f0e79b584f |
@@ -57,7 +57,7 @@ https://github.com/user-attachments/assets/adf84b93-684f-43f3-9948-6ba527213812
|
||||
我能想到的解决办法只有:
|
||||
|
||||
1. 根据下面的**如何构建(build)**,自行编译
|
||||
2. 希望你相信我的承诺,我承诺你在[Release页面](https://github.com/lanyeeee/bilibili-video-downloader/releases)下载到的所有东西都是安全的
|
||||
2. 希望你相信我的承诺,我承诺你在[Release页面](https://github.com/lanyeeee/bilibili-video-downloader/releases)下载到的所有东西都是安全的。切勿轻信他人分享的文件,请**仅**在[Release页面](https://github.com/lanyeeee/bilibili-video-downloader/releases)下载。任何不是从该页面下载的版本均可能**已被篡改**并**真的包含病毒**(而非误报),包括但不限于`网盘`、`通过邮箱或社交软件分享`、`issue或discussion里的文件`、`其他fork(仓库)`、`其他网站`
|
||||
|
||||
## 🛠️如何构建(build)
|
||||
|
||||
|
||||
+18
-10
@@ -27,28 +27,36 @@ export const useStore = defineStore('store', () => {
|
||||
})
|
||||
|
||||
function useProgresses() {
|
||||
// 内部的高频更新状态
|
||||
const _progresses = new Map<string, ProgressData>()
|
||||
// 对外暴露的响应式状态
|
||||
const progresses = ref<Map<string, ProgressData>>(new Map())
|
||||
|
||||
// 等待在同一渲染帧内执行的更新函数
|
||||
const pendingUpdateFns: Array<(progresses: Map<string, ProgressData>) => void> = []
|
||||
|
||||
// 用于确保在同一渲染帧内只安排一次UI更新
|
||||
let isUpdateScheduled = false
|
||||
|
||||
// 在同一渲染帧内集中执行等待中的更新函数
|
||||
// 将 `_progresses` 的内容更新到 `progresses` 中,并触发重新渲染
|
||||
const updateProgressesOnFrame = () => {
|
||||
isUpdateScheduled = false
|
||||
const newProgressesMap = new Map<string, ProgressData>()
|
||||
|
||||
const updateFns = pendingUpdateFns.splice(0)
|
||||
for (const updateFn of updateFns) {
|
||||
updateFn(progresses.value)
|
||||
for (const [key, value] of _progresses.entries()) {
|
||||
const progressData = progresses.value.get(key)
|
||||
|
||||
if (progressData !== undefined) {
|
||||
Object.assign(progressData, value)
|
||||
newProgressesMap.set(key, progressData)
|
||||
} else {
|
||||
newProgressesMap.set(key, { ...value })
|
||||
}
|
||||
}
|
||||
progresses.value = newProgressesMap
|
||||
|
||||
isUpdateScheduled = false
|
||||
}
|
||||
|
||||
const updateProgresses = (updateFn: (progresses: Map<string, ProgressData>) => void) => {
|
||||
// 将传入的更新函数添加到等待队列
|
||||
pendingUpdateFns.push(updateFn)
|
||||
// 使用传入的更新函数来修改 `_progresses`
|
||||
updateFn(_progresses)
|
||||
|
||||
if (!isUpdateScheduled) {
|
||||
// 如果没有安排过UI更新,则安排一次
|
||||
|
||||
Reference in New Issue
Block a user