@eclipse-scout/core
Version:
Eclipse Scout runtime
42 lines • 1.99 kB
TypeScript
import { PromiseCreator } from '../index';
export declare const promises: {
/**
* Use a promise creator to create a promise and wait until each promise has been done before the next
* promise is created and executed.
*
* @param {PromiseCreator} promiseCreator this function
*/
oneByOne(promiseCreator: PromiseCreator): JQuery.Promise<any>;
/**
* Use a promise creator to create a group of promises and wait until the whole group has been executed
* before creating and executing promises for the next group.
*/
groupwise(groupSize: number, promiseCreator: PromiseCreator): JQuery.Promise<any>;
/**
* Use a promise creator to try to keep a fixed size pool of promises of working. As soon as one
* promise is finished, the next promise will be created and executed (as a long as there are more
* promises available).
*
* @param maxPoolSize defines how many promises should be created and executed at most in parallel.
* @param timeout specifies a timeout to wait for until the next promise will be started. If not specified, no timeout (=0) is used).
*/
parallel(maxPoolSize: number, promiseCreator: PromiseCreator, timeout?: number): JQuery.Promise<any>;
};
/**
* A helper class providing a {@link Promise} along with its associated `resolve` and `reject` functions,
* allowing explicit control over the promise's state. Only the underlying {@link #promise} should be exposed,
* rather than the {@link Deferred} instance.
*
* This is similar to jQuery's `$.Deferred` function, but is purely based on native ES6 promises.
*
* @template T The type of the value that the promise resolves to.
*/
export declare class Deferred<T> {
protected _resolve: (value: T) => void;
protected _reject: (reason: any) => void;
protected _promise: Promise<T>;
resolve(value?: T): void;
reject(reason?: any): void;
promise(): Promise<T>;
}
//# sourceMappingURL=promises.d.ts.map