Manages the behavior of a timer.

Constructors

  • Creates a new timer.

    Parameters

    • name: string

      The name of the timer.

    • timeout: number | KosConfigProperty<number>

      The duration (in seconds) of the timer.

    • Optional defaultActions: TimerAction[]

      Optional default timer actions.

    Returns KosTimer

Methods

  • Starts the timer.

    Returns void

  • Pauses the timer.

    Returns void

  • Restarts the timer. The timer will continue to run from its initial state.

    Returns void

  • Resets the timer to its initial state. The timer will be stopped and reset to its initial state. The timer will need to be started again to continue running.

    Returns void

  • Adds a timeout action to the timer.

    Parameters

    • timerAction: TimerAction

      The timer action configuration to add.

    Returns void

  • Removes a timeout action from the timer by action name.

    Parameters

    • actionName: string

      The name of the action to remove.

    Returns void