kaven-basic - v4.5.1
    Preparing search index...

    Class Timer

    Represents a timer that can be used to schedule recurring tasks with a specified time interval.

    Index

    Constructors

    • Constructs a Timer object with the specified time interval.

      Parameters

      • interval: TimeSpan

        The time interval for the timer.

      Returns Timer

    Properties

    elapsed: KavenLiteEvent<number, Timer> = ...

    Event that is triggered on each elapsed interval of the timer.

    index: number = 0

    Index representing the number of times the timer has elapsed.

    interval: TimeSpan

    The time interval between each execution of the timer.

    lastInvocationDateTime?: DateTime
    ScheduleNextBeforeTrigger: boolean = false

    Indicates whether the next timer event should be scheduled before triggering the current one.

    startDateTime?: DateTime
    timeoutID?: string | number | Timeout

    Identifier of the currently scheduled timeout.

    Accessors

    • get Interval(): TimeSpan

      Gets the time interval of the timer.

      Returns TimeSpan

    • set Interval(value: TimeSpan): void

      Sets the time interval of the timer.

      Parameters

      Returns void

    • get Invocations(): number

      Gets the number of times the timer has been invoked. This property reflects the total count of elapsed intervals, indicating how many times the timer's 'Elapsed' event has been triggered.

      Returns number

    • get IsRunning(): boolean

      Gets a value indicating whether the timer is currently running.

      Returns boolean

    • get LastInvocationDateTime(): undefined | DateTime

      Gets the date and time when the timer was last invoked.

      Returns undefined | DateTime

    • get NextInvocationDateTime(): undefined | DateTime

      Gets the date and time when the next timer event is scheduled to occur.

      Returns undefined | DateTime

    • get StartDateTime(): undefined | DateTime

      Gets the date and time when the timer was started.

      Returns undefined | DateTime

    Methods

    • Resets the index to zero.

      Returns void

    • Restarts the timer by stopping it, resetting the index, and then starting it again.

      Returns void

    • Starts the timer.

      Returns void

      Error if the timer is already running.

    • Stops the timer.

      Returns void

    • Triggers the elapsed event and increments the index.

      Returns Promise<number>

      A promise that resolves with the current index.

    • Schedules the next timer event based on the timer's properties.

      Parameters

      • timer: Timer

        The timer instance.

      Returns void