Options
All
  • Public
  • Public/Protected
  • All
Menu

Queue manages tasks running in queue and ensures that every task run (function run) run one after another and not mixed up

Imagine timeline of task runs:

Input: __🥝🍓🍋_____🍏🍍🍇__🍉_🍌🍒___🥑🍎🍈

Output: ___🥝_🍓_🍋______🍏_🍍_🍇__🍉_____🍌_🍒___🥑_🍎_🍈

TODO: Error handling TODO: Probably debouncing TODO: timeouts

collboard-modules-sdk

Type parameters

  • TTaskResult

Hierarchy

  • Destroyable
    • Queue

Implements

  • ITaskRunner<TTaskResult>
  • IDestroyable

Index

Constructors

  • new Queue<TTaskResult>(): Queue<TTaskResult>
  • Type parameters

    • TTaskResult

    Returns Queue<TTaskResult>

Properties

taskToWait: any

Accessors

  • get isDestroyed(): boolean
  • Is this object destroyed?

    Returns boolean

Methods

  • addSubdestroyable(...subdestroyable: ITeardownLogic[]): Queue<TTaskResult>
  • Binds new registration with itself. This registration/destroyable will be destroyed with this.

    Parameters

    • Rest ...subdestroyable: ITeardownLogic[]

    Returns Queue<TTaskResult>

  • checkWhetherNotDestroyed(errorMessage?: string, runBeforeError?: () => void): void
  • Checks, whether the object is not destroyed

    Parameters

    • Optional errorMessage: string

      Message that will replace default one before error

    • Optional runBeforeError: () => void

      Callback runed before error is thrown; typically this can be some logging

        • (): void
        • Returns void

    Returns void

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

  • task(runner: () => Promisable<TTaskResult>): Promise<TTaskResult>
  • Parameters

    • runner: () => Promisable<TTaskResult>
        • (): Promisable<TTaskResult>
        • Returns Promisable<TTaskResult>

    Returns Promise<TTaskResult>

  • isDestroyable(obj: any): obj is IDestroyable
  • Chcek whether the given object is destroyable

    Parameters

    • obj: any

    Returns obj is IDestroyable