@amirsavand/ngx-common - v5.1.0
    Preparing search index...

    Class Timer

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

    Index

    Constructors

    Properties

    onInvoke: () => void

    Invoked on timer invoke.

    onStart?: () => void

    Invoked when timer starts.

    onStop?: () => void

    Invoked when timer stops.

    rate: number

    Timer rate in milliseconds.

    reference?: number

    Reference of the active timer.

    repeat: boolean

    Is this a repeating timer?

    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.

    • get timerMethod(): "setInterval" | "setTimeout"

      Gets the method used to create the timer (interval or timeout).

      Returns "setInterval" | "setTimeout"

      The timer creation method.

    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