Class AsyncTimer<Type>

A helper class that performs an async function at the given interval and emits the result on a regular basis

Type Parameters

  • Type = any

Hierarchy

  • ExtendedTimer<Type>
    • AsyncTimer

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • Type = any

    Parameters

    • func: (() => Promise<Type>)
    • interval: number
    • autostart: boolean = false

    Returns AsyncTimer<Type>

Properties

interval: number
paused: boolean = true

Accessors

  • get destroyed(): boolean
  • Returns if the timer has been destroyed

    Returns boolean

Methods

  • Destroys the timer

    Note: This is destructive, once destroyed, it cannot be restarted

    Returns void

  • Starts the timer

    Returns void

  • Stops the timer

    Returns void

  • Forces a tick event to be emitted with the specified arguments

    Parameters

    • Rest ...args: any[]

    Returns void

  • Toggles the timer on/off

    Returns boolean

    boolean whether the timer is running or not