Skip to content

Commit

Permalink
WIP [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
CMCDragonkai committed Aug 8, 2022
1 parent 93ad9d2 commit 88c2ec7
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions src/tasks/Task.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -45,17 +45,34 @@ class Task<T> extends Promise<T> {
/**
* This is called when `await` is used
*/
public then<TResult1, TResult2>(
public async then<TResult1 = T, TResult2 = never>(
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
): Promise<TResult1, | TResult2> {
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null
): Promise<TResult1 | TResult2> {

// 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<TResult1, TResult2 = never>(
// onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
// onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
// ): Promise<TResult1, | TResult2> {

// // these callbacks
// // how are they supposed to be used?
// // this is a promise
// return undefined as any;

// }

// then<TResult1 = T, TResult2 = never>(
// onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
// onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null):
Expand All @@ -73,11 +90,11 @@ class Task<T> extends Promise<T> {

// const t = new Task();

// const p = new Promise<void>((resolve, reject) => {
// resolve();
// });
const p = new Promise<void>((resolve, reject) => {
resolve();
});

// p.then
p.then
// p.catch
// p.finally
// /**
Expand Down

0 comments on commit 88c2ec7

Please sign in to comment.