This commit is contained in:
2023-06-10 10:53:48 +08:00
parent f64b1ebe61
commit a5488dcd35
9 changed files with 49 additions and 43 deletions

View File

@@ -55,11 +55,14 @@ class DownloadManager {
);
}
#sendEvent() {
return this.#manager.dispatchTaskProgressEvent(TaskType.Download, {
task_id: this.#task.id,
downloaded_page: this.#progress.downloaded_page,
total_page: this.#progress.total_page,
});
return this.#manager.dispatchTaskProgressEvent(
TaskType.Download,
this.#task.id,
{
downloaded_page: this.#progress.downloaded_page,
total_page: this.#progress.total_page,
},
);
}
async add_new_task(f: () => Promise<unknown>) {
while (1) {

View File

@@ -33,8 +33,7 @@ export async function export_zip(
added_page: 0,
};
const sendEvent = () => {
manager.dispatchTaskProgressEvent(TaskType.ExportZip, {
task_id: task.id,
manager.dispatchTaskProgressEvent(TaskType.ExportZip, task.id, {
added_page: progress.added_page,
total_page: progress.total_page,
});