createRepeatingTimer function


createRepeatingTimer

createRepeatingTimer (interval, function-to-call, parameters...) Creates a timer repeating every interval milliseconds that executes function-to-call with parameters...

The function-to-call function is called every interval milliseconds until the timer is canceled using the cancelTimer function.

Parameters:

interval - an integer containing the time interval in milliseconds.

function-to-call - a string containing the function to call.

parameters - a variable number of parameters that are passed to the timer function.

Returns:

Returns a variable containing the timer id. This may be passed to cancelTimer.

Example

The following code example shows how to create a timer that is fired in 30 seconds.

id = createRepeatingTimer(30000, "escalate", message)

The timer function escalate is an example of how to change the color of a message.

Example

function escalate(msg)
select when msg.COLOR == GREEN then
msg.COLOR = YELLOW
when msg.COLOR == YELLOW then
msg.COLOR = WHITE
when msg.COLOR == WHITE then
msg.COLOR = RED
end
return 0

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*