A factory function to create TaskTracker instances.

A TaskTracker tracks pending tasks (grouped by type) and notifies interested parties when all pending tasks (or tasks of a specific type) have been completed.

Constructors

Properties

ALL_TASKS_TYPE: string

Special task types used for tracking all tasks and default tasks.

DEFAULT_TASK_TYPE: string

Default task type.

Methods

  • Completes a task and decrements the associated task counter. If the counter reaches 0, all corresponding callbacks are executed.

    Parameters

    • fn: Function

      The function to execute when completing the task.

    • OptionaltaskType: string = ...

      The type of task being completed.

    Returns void

  • Increments the task count for the specified task type.

    Parameters

    • OptionaltaskType: string = ...

      The type of task whose count will be increased.

    Returns void

  • Registers a callback to be executed when all pending tasks of the specified type are completed. If there are no pending tasks of the specified type, the callback is executed immediately.

    Parameters

    • callback: Function

      The function to execute when no pending tasks remain.

    • OptionaltaskType: string = ...

      The type of tasks to wait for completion.

    Returns void