We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
quickApp ReferencesQuick GameRuntime Quick GameTimer

Timer

Definition

Expand

API

Description

setTimeout(function callback, number delay, any rest)

Sets a timer to execute the registered callback function when the timer expires and returns the timer ID. The timer ID can be passed to clearTimeout to cancel the timer.

clearTimeout(number timeoutID)

Cancels the timer set by the setTimeout() method.

setInterval(function callback, number delay, any rest)

Sets a timer to execute the registered callback function based on a specified period (in milliseconds) and returns the timer ID. The timer ID can be passed to clearInterval to cancel the timer.

clearInterval(number intervalID)

Cancels the timer set by the setInterval() method.

setTimeout(function callback, number delay, any rest)

  • Description

    Sets a timer to execute the registered callback function when the timer expires and returns the timer ID. The timer ID can be passed to clearTimeout to cancel the timer.

  • Parameters
    Expand

    Parameter

    Type

    Mandatory

    Description

    callback

    function

    Yes

    Callback function.

    delay

    number

    Yes

    Delay, in milliseconds, before the function is called.

    rest

    any

    No

    Additional parameters (param1,param2,…paramN) that are passed to the callback function.

  • Sample code
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. var id = setTimeout(
    2. function() {console.log("setTimeout");},
    3. 666,
    4. 'any'
    5. )

clearTimeout(number timeoutID)

  • Description

    Cancels the timer set by the setTimeout() method.

  • Parameters
    Expand

    Parameter

    Type

    Mandatory

    Description

    timeoutID

    number

    Yes

    Timer ID.

  • Sample code
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. clearTimeout(666)

setInterval(function callback, number delay, any rest)

  • Description

    Sets a timer to execute the registered callback function based on a specified period (in milliseconds) and returns the timer ID. The timer ID can be passed to clearInterval to cancel the timer.

  • Parameters
    Expand

    Parameter

    Type

    Mandatory

    Description

    callback

    function

    Yes

    Callback function.

    delay

    number

    Yes

    Delay, in milliseconds, before the function is called.

    rest

    any

    No

    Additional parameters (param1,param2,…paramN) that are passed to the callback function.

  • Sample code
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. var id = setInterval(
    2. function() {console.log("setInterval");},
    3. 666,
    4. 'any'
    5. )

clearInterval(number intervalID)

  • Description

    Cancels the timer set by the setInterval() method.

  • Parameters
    Expand

    Parameter

    Type

    Mandatory

    Description

    intervalID

    number

    Yes

    Timer ID.

  • Sample code
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. clearInterval(666)
Search in References
Enter a keyword.