diff --git a/src/abortAble.ts b/src/abortAble.ts index ea14076..54e4d96 100644 --- a/src/abortAble.ts +++ b/src/abortAble.ts @@ -5,6 +5,7 @@ export function isPromiseLike(p: PromiseLike | any): p is PromiseLike export interface IAbortAblePromiseBase extends PromiseLike { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): IAbortAblePromiseBase; abort(): void; + isAborted(): boolean; } export declare type IAbortAblePromise = IAbortAblePromiseBase; @@ -33,7 +34,8 @@ function thenFactory(loader: PromiseLike, isAborted: () => boolea }); return { then: thenFactory(fullfiller, isAborted, abort), - abort + abort, + isAborted }; } return then; @@ -60,7 +62,8 @@ export default function abortAble(loader: PromiseLike): IAAP { return { then: thenFactory(race, isAborted, abort), - abort + abort, + isAborted }; } @@ -96,7 +99,8 @@ export function abortAbleAll(values: any[]): IAAP { return { then: thenFactory(race, isAborted, abort), - abort + abort, + isAborted }; } @@ -125,11 +129,13 @@ export function abortAbleResolveNow(value: T) { } return { then: abortAbleResolveNow(res), - abort: () => undefined + abort: () => undefined, + isAborted: () => false }; } return { then, - abort: () => undefined + abort: () => undefined, + isAborted: () => false }; }