This commit is contained in:
2023-05-31 09:44:14 +08:00
parent 3fab4a8fc5
commit 5d75c211a7
4 changed files with 62 additions and 17 deletions

19
task.ts
View File

@@ -1,3 +1,5 @@
import { DiscriminatedUnion } from "./utils.ts";
export enum TaskType {
Download,
ExportZip,
@@ -11,3 +13,20 @@ export type Task = {
pid: number;
details: string | null;
};
export type TaskDownloadProgess = {
downloaded_page: number;
total_page: number;
};
export type TaskExportZipProgress = {
added_page: number;
total_page: number;
};
export type TaskProgressType = {
[TaskType.Download]: TaskDownloadProgess;
[TaskType.ExportZip]: TaskExportZipProgress;
};
export type TaskProgress = DiscriminatedUnion<"type", TaskProgressType>;