API C_Timer.NewTimer

From Wowpedia
Jump to: navigation, search
"I" iconThis function is implemented by FrameXML in SharedXML/C_TimerAugment.lua.

Creates a new timer and returns its handle.

local timer = C_Timer.NewTimer(duration, callback)

Arguments

duration
Number - Seconds before the timer completes
callback
Function - What you want to execute when the timer's duration has elapsed

Returns

timer
Table - A handle for a timer which has an attached function (:Cancel()) and the following default properties - _callback and _cancelled

Blizzard Notes

Creates and starts a cancellable timer that calls callback after duration seconds.

Note that C_Timer.NewTimer and C_Timer.NewTicker are significantly more expensive than C_Timer.After and should be only used if you actually need any of their additional functionality.

While timers are currently just tickers with an iteration count of 1, this is likely to change in the future and shouldn't be relied on.

Patch changes

See also