Run a task in a fixed period loop.

Hierarchy

  • TaskLooper

Constructors

Properties

Methods

Constructors

  • 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

  • Parameters

    • periodInMs: number

    Returns Promise<void>

  • Start the task loop.

    Parameters

    • periodInMs: number

      the loop period in milliseconds

    Returns void

Generated using TypeDoc