all .valueOf to task

This commit is contained in:
方而静 2023-10-31 10:38:59 +08:00
parent 5da69558a9
commit acf668a7ee
Signed by: szTom
GPG Key ID: 072D999D60C6473C

View File

@ -77,6 +77,23 @@ export class Task {
return this.#promise; return this.#promise;
} }
valueOf() {
return {
status: Task.STATUS_NAME[this.status],
result: this.result,
error: this.error,
};
}
};
Task.STATUS_NAME = {
0: 'Pending',
1: 'Running',
2: 'Interupting',
3: 'Ready',
4: 'Interupted',
5: 'Failed',
}; };
Task.STATUS = { Task.STATUS = {