Represents a timer that can be started, stopped, and repeated at a specified rate.

Constructors

Accessors

Methods

Constructors

Accessors

  • get started(): boolean
  • Determines whether the timer has started.

    Returns boolean

    A boolean indicating if the timer has started.

  • get stopped(): boolean
  • Determines whether the timer has stopped.

    Returns boolean

    A boolean indicating if the timer has stopped.

Methods

  • Triggers the callback function associated with the timer. This method can be called manually to simulate the timer invocation.

    Returns void

  • Starts the timer.

    If the timer is already started, it will be stopped first and then restarted.

    Returns void

  • Stops the timer if it is currently running. If the timer is a repeating timer, it will be stopped using clearInterval. If the timer is a non-repeating timer, it will be stopped using clearTimeout.

    Returns void