diff --git a/src/tasks/Task.ts b/src/tasks/Task.ts index 35415e03e8..6d94274500 100644 --- a/src/tasks/Task.ts +++ b/src/tasks/Task.ts @@ -1,4 +1,4 @@ -import type Queue from "./Queue"; +import type Queue from "./Scheduler"; import type { TaskId, TaskData } from "./types"; // do we say the task info @@ -45,17 +45,34 @@ class Task extends Promise { /** * This is called when `await` is used */ - public then( + public async then( onFulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, - onRejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, - ): Promise { + onRejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null + ): Promise { - // these callbacks - // how are they supposed to be used? - // this is a promise + // this is the promise now + // we can say that we only do what is needed + // we can make this `then` asynchronous + // do we use the same db + // or ask the Task to have the same capability? + + + return undefined as any; } + // public then( + // onFulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, + // onRejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, + // ): Promise { + + // // these callbacks + // // how are they supposed to be used? + // // this is a promise + // return undefined as any; + + // } + // then( // onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, // onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): @@ -73,11 +90,11 @@ class Task extends Promise { // const t = new Task(); -// const p = new Promise((resolve, reject) => { -// resolve(); -// }); +const p = new Promise((resolve, reject) => { + resolve(); +}); -// p.then +p.then // p.catch // p.finally // /**