Reputation: 11
I have a doubt about timer.performWithDelay()
.
When I want to loop a function every set amount of time I adopt the normal formula
timer.performWithDelay( delay, function, 0 )
The function gets called after the delay value for the first time, and again every delay. Is there any way to loop the same function without having to wait the first time?
Just to clarify:
EXECUTION -> delay -> EXECUTION -> delay -> EXECUTION -> delay (etc)
Instead of:
delay -> EXECUTION -> delay -> EXECUTION -> delay -> EXECUTION (etc)
Upvotes: 1
Views: 968
Reputation: 26794
Why not explicitly call it first time (replacing function
, which is a keyword, with func
):
timer.performWithDelay( delay, func, 0 )
func()
Upvotes: 8