Function interval

  • Schedules and returns a new timer, invoking the specified callback repeatedly every 'delay' milliseconds until the timer is stopped. The callback is passed the (apparent) elapsed time since the timer became active.

    Parameters

    • callback: ((elapsed) => void)

      A callback function to be invoked and passed in the apparent elapsed time since the timer became active in milliseconds.

        • (elapsed): void
        • Parameters

          • elapsed: number

          Returns void

    • Optional delay: number

      An optional numeric delay in milliseconds between repeat invocations of the callback. If not specified, the interval timer behaves like the regular timer.

    • Optional time: number

      An optional time in milliseconds relative to which the initial delay is calculated (default = now).

    Returns Timer