Function punctualTimer

  • punctual setInterval

    Type Parameters

    • TArgs extends any[]

    Parameters

    • handler: (args: void) => void

      A function to be executed after the timer expires.

    • delay: number

      The time, in milliseconds that the timer should wait before the specified function or code is executed. If this parameter is omitted, a value of 0 is used, meaning execute "immediately", or more accurately, the next event cycle.

    • Optionalargs: TArgs

      Additional arguments which are passed through to the function specified by handler.

    Returns PunctualTimerReturns

    const printDate = () => console.log(new Date())
    const timer = punctualTimer(printDate, 1000)
    console.log(timer.count) // 10
    timer.clear() // clear punctualTimer or use clearTimeout(timer.timer)

    5.18.0

  • punctual setInterval

    Type Parameters

    • TArgs extends any[]

    Parameters

    • handler: (...args: TArgs) => void

      A function to be executed after the timer expires.

    • delay: number

      The time, in milliseconds that the timer should wait before the specified function or code is executed. If this parameter is omitted, a value of 0 is used, meaning execute "immediately", or more accurately, the next event cycle.

    • Optionalargs: TArgs

      Additional arguments which are passed through to the function specified by handler.

    Returns PunctualTimerReturns

    const printDate = () => console.log(new Date())
    const timer = punctualTimer(printDate, 1000)
    console.log(timer.count) // 10
    timer.clear() // clear punctualTimer or use clearTimeout(timer.timer)

    5.18.0