hosanna-ui-docs - v0.9.0
    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.

    timers: Record<string, Timer> = {}

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

    Methods

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

      Parameters

      • callback: Function

        The function to execute.

      • delay: 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.

      • timeout: 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.

      • interval: number

        The interval in milliseconds.

      • repeat: boolean = false

        Whether the timer should repeat (default: false).

      Returns number

      The unique identifier for the timer.