/** * TaskManager is a utility class that collects asynchronous tasks * and executes them in parallel. * * This is especially useful for orchestrating optional async operations * where not all tasks need to be executed every time. * * Example: * ```ts * const taskManager = new TaskManager(); * taskManager.add(async () => { ... }); * taskManager.add(async () => { ... }); * await taskManager.run(); * ``` */ export declare class TaskManager { private tasks; /** * Adds a new asynchronous task to the queue. * * @param task - A function that returns a Promise. * It should contain the actual async logic to be executed. */ add(task: () => Promise): void; /** * Executes all queued tasks in parallel and waits for their completion. * * - Tasks are executed concurrently using `Promise.all`. * - If one task fails, the error will propagate and stop execution. */ run(): Promise; /** * Clears all tasks from the queue without executing them. * Useful if you want to reset and reuse the TaskManager instance. */ clear(): void; }