Type Alias IntervalOptions

IntervalOptions: {
    callback: (() => void);
    componentRef?: Component;
    delay: number;
    entityRef?: Entity;
    executeImmediately?: boolean;
    times?: number;
    useTimeScale?: boolean;
}

Options for configuring an interval timer.

Type declaration

  • callback: (() => void)

    The function to execute at each interval

      • (): void
      • Returns void

  • OptionalcomponentRef?: Component

    Component reference to cancel the interval when the component is disabled or destroyed

  • delay: number

    The time in milliseconds between each execution

  • OptionalentityRef?: Entity

    Entity reference to cancel the interval when the entity is disabled or destroyed

  • OptionalexecuteImmediately?: boolean

    Whether to execute the callback immediately before starting the interval timer

  • Optionaltimes?: number

    Optional number of times to execute before auto-clearing. Omit for infinite execution.

  • OptionaluseTimeScale?: boolean

    Whether to use the time scale for the interval, default is TRUE

const intervalId = timeManager.setInterval({
callback: () => console.log("Will be called 5 times!"),
delay: 1000,
times: 5,
});