Search:
Class o2.Timer
static
class
o2.Timer
Function Summary
Sets and optionally starts a new timer.
Usage example:
o2.Timer.set('myTimer', function() { console.log('hello'); }, 1000, {repeat : true});
Starts/restarts the timer with the given id.
Usage example:
o2.Timer.start('myTimer');
Function Details
function set
Sets and optionally starts a new timer.
Usage example:
o2.Timer.set('myTimer', function() { console.log('hello'); }, 1000, {repeat : true});
Parameters:
id
- a unique identifier for the timer.
delegate
- action to be done when the timer ticks.
timeout
- interval of the timer in milliseconds.
option
- optional configuration in the form
{start: true, repeat: true}
, if start
is true
timer will start after being set; otherwise
it should be explicitly started using the
o2.Timer.start method. If repeat is
false
the delegate will be executed only once, othwerwise
it will be executed at each interval until o2.Timer.stop
is called. function start
static
start(String
id)
Starts/restarts the timer with the given id.
Usage example:
o2.Timer.start('myTimer');
Parameters:
id
- the id of the timer to start. function stop
static
stop(String
id)
Stops the timer with the given id.
Usage example:
o2.Timer.stop('myTimer');
Parameters:
id
- the id of the timer to stop.
A class for executing repeated timed actions.
Usage example: