Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TaskQueueLike

TaskQueue aspect.

Hierarchy

  • TaskQueueLike

Implemented by

Index

Methods

Methods

add

  • add(task: Task<void>, onFinally?: () => void | Promise<void>): void
  • Add task to the queue, and disregard its result. Fire-and-forget semantics.

    Parameters

    • task: Task<void>

      task to run

    • Optional onFinally: () => void | Promise<void>

      function to call when the task is finished, optional

        • (): void | Promise<void>
        • Returns void | Promise<void>

    Returns void

run

  • run<T>(task: Task<T>): Promise<T>
  • Add task to the queue. Return its result in Promise. The point of run (as opposed to add) is to pass an error to the caller if it is throw inside a task. Note "fire-and-forget" comment for the add method.

    Type parameters

    • T

    Parameters

    Returns Promise<T>