export interface Result { amountDone: number; amountStarted: number; amountResolved: number; amountRejected: number; amountNextCheckFalsey: number; rejectedIndexes: number[]; resolvedIndexes: number[]; nextCheckFalseyIndexes: number[]; taskResults: T[]; } export interface Options { maxInProgress?: number; failFast?: boolean; progressCallback?: (result: Result) => void; nextCheck?: nextTaskCheck; } export declare type Task = () => Promise; export declare type Tasks = Array>; export declare type nextTaskCheck = (status: Result, tasks: Tasks) => Promise; /** * Raw throttle function, which can return extra meta data. * @param tasks required array of tasks to be executed * @param options Options object * @returns {Promise} */ export declare function raw(tasks: Tasks, options?: Options): Promise>; /** * Simply run all the promises after each other, so in synchronous manner * @param tasks required array of tasks to be executed * @param options Options object * @returns {Promise} */ export declare function sync(tasks: Tasks, options?: Options): Promise; /** * Exposes the same behaviour as Promise.All(), but throttled! * @param tasks required array of tasks to be executed * @param options Options object * @returns {Promise} */ export declare function all(tasks: Tasks, options?: Options): Promise;