Q: adding inspect() method, changing return type of getSettled

As per documentation:
https://github.com/kriskowal/q/wiki/API-Reference#promiseallsettled
https://github.com/kriskowal/q/wiki/API-Reference#promiseinspect
This commit is contained in:
anchann
2013-08-16 07:42:33 +09:00
parent 8220ab27e7
commit eacef69706
2 changed files with 27 additions and 4 deletions
Vendored
+11 -3
View File
@@ -60,6 +60,14 @@ declare module Q {
isPending(): boolean;
valueOf(): any;
inspect(): PromiseState<T>;
}
interface PromiseState<T> {
state: string /* "fulfilled", "rejected", "pending" */;
value?: T;
reason?: any;
}
// if no fulfill, reject, or progress provided, returned promise will be of same type
@@ -96,8 +104,8 @@ declare module Q {
export function all<T>(promises: any[]): Promise<T[]>;
export function all<T>(promises: IPromise<T>[]): Promise<T[]>;
export function allSettled<T>(promises: any[]): Promise<Promise<T>[]>;
export function allSettled<T>(promises: IPromise<T>[]): Promise<Promise<T>[]>;
export function allSettled<T>(promises: any[]): Promise<PromiseState<T>[]>;
export function allSettled<T>(promises: IPromise<T>[]): Promise<PromiseState<T>[]>;
export function allResolved<T>(promises: any[]): Promise<Promise<T>[]>;
export function allResolved<T>(promises: IPromise<T>[]): Promise<Promise<T>[]>;
@@ -145,4 +153,4 @@ declare module Q {
declare module "q" {
export = Q;
}
}