Hosanna UI API v1.30.2-next
    Preparing search index...

    TimerService manages timers and tickable objects. It provides methods for setting and clearing timers, as well as managing periodic updates.

    Index

    Constructors

    Properties

    lastTickTime: number = 0
    nextId: number = 0

    The next available unique identifier for a timer.

    Injected system service for time management.

    tickables: Record<string, TimerService.ITickable> = {}

    A record of registered tickable objects, keyed by their unique identifiers.

    tickDebugCount: number = 0
    timers: Record<string, Timer | undefined> = {}

    A record of active timers, keyed by their unique identifiers.

    Methods

    • Handles periodic updates for timers and tickable objects.

      Parameters

      • delta: number

        The time delta in milliseconds since the last update.

      Returns void

    • Clears an interval timer by its unique identifier.

      Parameters

      • timerId: number

        The unique identifier of the timer to clear.

      Returns void

    • Clears all registered tickable objects.

      Returns void

    • Clears a timeout timer by its unique identifier.

      Parameters

      • timerId: number

        The unique identifier of the timer to clear.

      Returns void

    • Clears all active timers.

      Returns void

    • Returns number

    • Registers a tickable object for periodic updates.

      Parameters

      Returns void

    • Sets a repeating timer that executes a callback function at a specified interval.

      Parameters

      • callback: Function

        The function to execute.

      • Optionaldelay: number

        The interval in milliseconds.

      Returns number

      The unique identifier for the timer.

    • Sets a one-time timer that executes a callback function after a specified timeout.

      Parameters

      • callback: Function

        The function to execute.

      • Optionaltimeout: number

        The timeout in milliseconds.

      Returns number

      The unique identifier for the timer.

    • Sets a timer that executes a callback function after a specified interval.

      Parameters

      • callback: Function

        The function to execute.

      • Optionalinterval: number

        The interval in milliseconds.

      • repeat: boolean = false

        Whether the timer should repeat (default: false).

      Returns number

      The unique identifier for the timer.