Function timeout

  • Schedules and returns a new timer, invoking the specified callback. The timer is stopped automatically on its first callback. 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 (default = 0) relative to time.

    • Optional time: number

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

    Returns Timer