Class SyncTimer<Type>

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

Type Parameters

  • Type = any

Hierarchy

  • ExtendedTimer<Type>
    • SyncTimer

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • Type = any

    Parameters

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

    Returns SyncTimer<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