API-Version: 1.9

timer

Static object for timed execution

Source:

Methods

<static> start(interval, callback) → {Object}

Calls a function reqeatedly or after a timeout, similar to window.setInterval or window.setTimeout that are available in the webcontext.

Parameters:
Name Type Description
interval Number

The interval in milliseconds, the minimum interval is 10 milliseconds

callback timer~startCallback

The callback that will be called, if the callback returns false the timer will be stopped

Source:
Returns:

A handle, call handle.remove or timer.stop(handle) to stop the timer.

Type
Object
Example
 
// equivalent to window.setInterval
timer.start(1000, function() {
     ...
});
// equivalent to window.setTimeout
timer.start(1000, function() {
     ...
     return false;
});

<static> stop(id) → {Boolean}

Stops a timer started by timerStart

Parameters:
Name Type Description
id Number

A timer handle retrieved from start

Source:
Returns:

true if the timer was stopped

Type
Boolean

Type Definitions

startCallback() → {Boolean}

Source:
Returns:

Return true to stop the timer

Type
Boolean