Timer Class
Generates recurring events in an application.
Example:
// Just one scheduled execution:
var once = new Timer(100, false); // interval make no sense here
once.start(500); // dealyed start
once.onTick = function(sender) { }
// each 500ms, repeats 3times only:
var threeTimes = new Timer(500, 3);
// each 500ms, repeats forever
var threeTimes = new Timer(500, true);
Methods
this
(
interval
repeatOrTimes
Constructs timer object.
dispose
()
Stops and disposes timer object.
start
(
[delay]
Starts this timer.
Parameters:
-
[delay]
Integer optionalIndicates delayed start. Values is expressed in miliseconds.
stop
()
Stops this timer. Stopped timer is still valid and can be used later. To destruct timer object you have to call dispose() method.
Events
onTick
The onTick event apperas in regular time intervals according to set time interval in costructor.
Example:
var once = new Timer(100, false); // interval make no sense here
once.start(500); // dealyed start
once.onTick = function(sender) { }