Class Group<T, U>

Represents the task handler

Type Parameters

  • T
  • U

Hierarchy (View Summary)

Constructors

  • Create a new task handler for a group of tasks

    Type Parameters

    • T
    • U

    Parameters

    • tasks: TaskHandler<T, U>[]

      The tasks to execute

    • Optionaloptions: TaskOptions<U>

      The options for the task

    • OptionalatLeastOne: boolean

      If at least one task must succeed to consider the group as successful execution, in other case, all the tasks must succeed

    Returns Group<T, U>

Properties

createdAt: Date

Date when the task was created

priority: number

Task priority

taskId: string

Task identifier, defined by the user

uuid: string

Unique task identification, unique for each task

weight: number

Task weight

Accessors

  • get metadata(): MetaData
  • Return the metadata of the task

    Returns MetaData

Methods

  • Register an event listener over the done event, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: "done"

      done event

    • listener: DoneListener<(null | T)[]>

      Done event handler

    Returns this

  • Execute the task

    Returns Promise<(null | T)[]>

  • Removes the specified listener from the listener array for the done event.

    Parameters

    • event: "done"

      done event

    • listener: DoneListener<(null | T)[]>

      Done event handler

    Returns this

  • Register an event listener over the done event, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: "done"

      done event

    • listener: DoneListener<(null | T)[]>

      Done event handler

    Returns this

  • Registers a one-time event listener over the done event, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: "done"

      done event

    • listener: DoneListener<(null | T)[]>

      Done event handler

    Returns this

  • Registers a event listener over the done event, at the beginning of the listeners array, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: "done"

      done event

    • listener: DoneListener<(null | T)[]>

      Done event handler

    Returns this

  • Registers a one-time event listener over the done event, at the beginning of the listeners array, which is emitted when a task has ended, either due to completion or failure.

    Parameters

    • event: "done"

      done event

    • listener: DoneListener<(null | T)[]>

      Done event handler

    Returns this

  • Removes all listeners, or those of the specified event.

    Parameters

    • Optionalevent: "done"

      done event

    Returns this

  • Removes the specified listener from the listener array for the done event.

    Parameters

    • event: "done"

      done event

    • listener: DoneListener<(null | T)[]>

      Done event handler

    Returns this