Options
All
  • Public
  • Public/Protected
  • All
Menu

Run a task in a fixed period loop.

Hierarchy

  • TaskLooper

Index

Constructors

  • new TaskLooper(fn: () => Promise<void>): TaskLooper
  • Build the looper with a function to invoke on a fixed period loop.

    Parameters

    • fn: () => Promise<void>

      the async function to invoke

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

    Returns TaskLooper

Properties

_fn: () => Promise<void>

Type declaration

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

_isLooping: boolean
_isStarted: boolean
_timeout: undefined | Timeout

Methods

  • _runLoop(periodInMs: number): Promise<void>
  • start(periodInMs: number): void
  • Start the task loop.

    Parameters

    • periodInMs: number

      the loop period in milliseconds

    Returns void

  • stop(): void

Generated using TypeDoc