-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(task): fixed task abort resolutions
- Loading branch information
1 parent
5251cfe
commit 29e1005
Showing
4 changed files
with
60 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export class TaskAbortError extends Error { | ||
|
||
public reason: any; | ||
|
||
constructor(reason?: any) { | ||
super('Task aborted'); | ||
this.reason = reason; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
export type Product<TResult = void> = (...args: any[]) => TResult; | ||
export type TaskResolve<TResult> = (value: TResult | PromiseLike<TResult>) => void; | ||
export type TaskReject = (reason?: unknown) => unknown; | ||
export type TaskAbortCallback = (reason?: unknown) => void; | ||
export type TaskAbortedCallback = (reason?: unknown) => void; | ||
|
||
export type TaskExecutor<T> = ( | ||
resolve: (value: T | PromiseLike<T>) => void, | ||
reject: (reason?: unknown) => unknown, | ||
export type TaskExecutor<TResult> = ( | ||
resolve: TaskResolve<TResult>, | ||
reject: TaskReject, | ||
controller: AbortController, | ||
onAbort: (callback: TaskAbortCallback) => void | ||
onAbort: (callback: TaskAbortCallback) => void, | ||
onAborted: (callback: TaskAbortedCallback) => void | ||
) => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters