ecspresso
    Preparing search index...

    Interface Timer<Slots>

    A single timer's data. Multiple of these can live on one entity, keyed by slot name. Use justFinished to detect completion in your systems.

    interface Timer<Slots extends string = string> {
        active: boolean;
        duration: number;
        elapsed: number;
        justFinished: boolean;
        onComplete?: (data: TimerEventData<Slots>) => void;
        repeat: boolean;
    }

    Type Parameters

    • Slots extends string = string
    Index

    Properties

    active: boolean

    Whether the timer is currently running

    duration: number

    Target duration (seconds)

    elapsed: number

    Time accumulated so far (seconds)

    justFinished: boolean

    True for one frame after the timer completes

    onComplete?: (data: TimerEventData<Slots>) => void

    Optional callback invoked when the timer completes

    repeat: boolean

    Whether the timer repeats after completion