///
import { EventEmitter } from 'events';
import { TaskObject } from './task-object';
export type TaskProcessor = (task: TaskObject) => void | Promise;
export type AfterFinishProcessor = () => void | Promise;
interface IQueuingItem {
queueId: number | null;
task: T;
processor: TaskProcessor;
}
/**
* Scarlet is a task queue that allows you to process tasks in parallel.
*/
export declare class Scarlet {
#private;
static TaskObject: typeof TaskObject;
queueCount: number;
processedCount: number;
spouts: (IQueuingItem | null)[];
running: boolean[];
queue: IQueuingItem[];
emitter: EventEmitter;
afterFinishCount: number;
afterFinishLoop: boolean;
afterFinishProcessor: AfterFinishProcessor | undefined;
/**
* Create a new Scarlet instance.
* @param {number} queueCount The number of queues to create.
*/
constructor(queueCount?: number);
/**
* Get the number of processed tasks.
* @return {number} The number of processed tasks.
*/
numberOfProcessed(): number;
/**
* Reset the number of processed tasks.
*/
resetNumberOfProcessed(): void;
/**
* Push a task into the queue.
* @param {T} task The task to push into the queue.
* @param {TaskProcessor} processor The processor to run the task.
*/
push(task: T, processor: TaskProcessor): void;
/**
* Mark a task as done.
* @param {TaskObject} taskObject The task object to mark as done.
*/
taskDone(taskObject: TaskObject): void;
/**
* Set the after finish processor.
* @param {number} count The number of tasks to process before calling the processor.
* @param {AfterFinishProcessor} processor The processor to call after the tasks are processed.
* @param {boolean} loop Whether to loop the after finish processor.
*/
afterFinish(count: number, processor: AfterFinishProcessor, loop?: boolean): void;
/**
* Clear the after finish processor.
*/
clearAfterFinish(): void;
}
export {};