Skip to content

setTimeout

setTimeout(callback, delay, uniqueKey)

Runs callback after the specified delay time. Returns integer which can be utilized by the clearTimeout() function. Intervals are only called once per frame.

ParameterTypeRequiredDefaultDescription
callbackfunctionYes-Function to be called after the delay.
delaynumberNo0Delay time in seconds.
uniqueKeyanyNonilUnique identifier for the timer.
  • integer CancellationID for the timeout. Can be used to cancel the timeout with clearTimeout().
setTimeout(function()
ac.log("This message is printed after 2 seconds")
end, 2)