UNPKG

1.01 kBTypeScriptView Raw
1/**
2 * Utils to help to work with Promise objects.
3 */
4export declare class PromiseUtils {
5 /**
6 * Creates a new promise with resolved value used for lazy relations.
7 */
8 static create(value: any): Promise<any>;
9 /**
10 * If given value is a promise created by "create" method this method gets its value.
11 * If given value is not a promise then given value is returned back.
12 */
13 static extractValue(object: any): any;
14 /**
15 * Runs given callback that returns promise for each item in the given collection in order.
16 * Operations executed after each other, right after previous promise being resolved.
17 */
18 static runInSequence<T, U>(collection: T[], callback: (item: T) => Promise<U>): Promise<U[]>;
19 /**
20 * Returns a promise that is fulfilled with an array of promise state snapshots,
21 * but only after all the original promises have settled, i.e. become either fulfilled or rejected.
22 */
23 static settle(promises: Promise<any>[]): Promise<any>;
24}
25
\No newline at end of file