Initializes a new TaskManager
instance.
Protected
_flagsCurrent flags for the task manager.
Protected
_modeCurrent execution mode of the task manager.
Protected
_progressCurrent progress of tasks, represented as a value between 0 and 1.
Protected
_statusCurrent status of the task manager.
Protected
flowManages task execution and flow control.
Query interface for accessing and managing tasks.
Retrieves the current flags of the task manager as an array.
Updates the flags for the task manager.
New set of flags to apply.
Checks if the task queue is empty.
Current execution mode of the task manager.
Updates the execution mode.
New execution mode to set.
Retrieves the current progress of tasks.
Updates the progress of tasks.
New progress value (0 to 1).
Retrieves the current status of the task manager.
Updates the status of the task manager.
New status to set.
Retrieves all tasks managed by the task manager.
Adds a flag to the task manager.
Flag to add.
Instance of the task manager for chaining.
Adds a task to the task queue.
Task to add.
The instance of the task manager for chaining.
Adds multiple tasks to the task queue.
Array of tasks to add.
The instance of the task manager for chaining.
Removes all listeners for all event types, as well as all global listeners.
The EventEmitter instance itself, allowing for method chaining.
Emits an event of a specific type, invoking all registered listeners for that event type with the provided data. Also calls any global event listeners with a GlobalEvent object.
Event type.
The identifier for the event type to emit.
The data to pass to the event listeners. The type of this data is defined by the corresponding value in TEvents.
The EventEmitter instance itself, allowing for method chaining.
Checks if a specific flag is set in the task manager.
Flag to check.
true
if the flag is set.
Checks if all specified flags are set in the task manager.
Flags to check.
true
if all specified flags are set.
Checks if the current status matches any of the provided statuses.
Array of statuses to check against.
true
if the current status matches any provided status.
Removes a previously registered event listener for a specified event type. Use this method to unregister listeners when they are no longer needed, preventing potential memory leaks.
Event type.
The identifier for the event type from which to remove the listener.
The callback function to unregister.
The EventEmitter instance itself, allowing for method chaining.
Removes a previously registered global event listener.
The global event listener to remove.
The EventEmitter instance itself, allowing for method chaining.
Adds an event listener for a specified event type. This method allows you to specify which event you are interested in listening to and to provide a callback function that will be executed whenever that event is emitted.
Event type.
The identifier for the event type to listen for.
The callback function that will be called when the event is emitted.
The EventEmitter instance itself, allowing for method chaining.
Adds a global event listener that is called for every emitted event.
The global event listener to add.
The EventEmitter instance itself, allowing for method chaining.
Removes a flag from the task manager.
Flag to remove.
Instance of the task manager for chaining.
Sets the flags for the task manager.
Flags to set.
Instance of the task manager for chaining.
Sets the execution mode.
Execution mode to set.
Instance of the task manager for chaining.
Protected
setSets the progress of tasks.
Progress value to set.
Instance of the task manager for chaining.
Protected
setSets the status of the task manager.
Status to set.
Instance of the task manager for chaining.
Starts executing tasks in the queue.
Optional
force: booleanIf true
, starts even if the manager is in an error state.
A promise that resolves when execution starts.
Manages task execution, including queue management, progress control, and event handling.
Supports sequential and parallel execution modes and provides methods to query, retrieve, and manage task results.