import { Abortable, 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; /** * 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; /** * 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; /** * If the given value is a promise, the callback function is executed asynchronously once the promise resolves. * Otherwise, the callback function is executed immediately. * * @value a promise or a value that will be passed to the callback function * @returns a promise or the result of the callback function */ thenOrNow(value: TValue | JQuery.Promise, callback: (value: TValue) => TResult): TResult | JQuery.Promise; /** * Ensures the given value is a promise. * * If the value is a promise, that promise is returned. * Otherwise, a new resolved promise for the value is returned. */ ensure(value: T | JQuery.Promise): JQuery.Promise; }; /** * 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 { protected _resolve: (value: T) => void; protected _reject: (reason: any) => void; protected _promise: Promise; resolve(value?: T): void; reject(reason?: any): void; promise(): Promise; } /** * A helper class that makes ES6 promises abortable. The {@link AbortablePromise} is itself a ES6 promise and can be used similarly. * When it is aborted is will be rejected with a {@link AbortError}. */ export declare class AbortablePromise extends Promise implements Abortable { protected _reject: (reason: any) => void; constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void); /** * Creates an {@link AbortablePromise} from the given ES6 promise. */ static of(promise: PromiseLike): AbortablePromise; /** * Aborts this promise with a {@link AbortError}. */ abort(): void; } //# sourceMappingURL=promises.d.ts.map