Javascript Library.
Commands 0 |
---|
Added in v 1.0.0
Creating a timer to call a function or evaluates an expression at specified intervals (in milliseconds).
As in v 1.0.0
new _z.timer(function);
Returns: Object Timer object
This method is a shortcut for _z.timer(1000, function).
new _z.timer(function, milliseconds);
Returns: Object Timer object
Timer object is object contains all timer options (interval, callback function, stop(), …).
To create Timer object use:
var timer = new _z.timer(function);
So that timer is variable contains Timer object.
_z.timer.hold
_z.timer.interval
_z.timer.instances
_z.timer.startAll()
_z.timer.stopAll()
_z.timer.removeAll(keepData)
var timer1 = new _z.timer(function() {
document.title = fns.time('s') + ":" + fns.time('m');
});
// execute every 1 second
timer1.interval = 1000 * 1;
timer1.isRunning; // false
timer1.isReady(); // true
timer1.start();
timer1.isReady(); // false
timer1.isRunning; // true
timer1.stop();
timer1.isRunning; // false
timer1.start();
timer1.isRunning; // true
_z.timer.startAll();
timer1.isRunning; // true
var timer2 = new _z.timer(function() {
document.title = "Execite once";
});
timer2.once(true); // set as one timer execution **execute after X second**
timer2.isReady(); // true
timer2.start(); // EXECUTE SUCCESS
timer2.isReady(); // false
timer2.isRunnung; // false
timer2.start(); // EXECUTE FAILD
timer2.execFunction(); // EXECUTE SUCCESS
timer1.isRunnung; // true
timer2.isRunnung; // false
_z.timer.hold = true;
timer1.isRunnung; // false
timer2.isRunnung; // false
_z.timer.hold = false;
timer1.isRunnung; // true
timer2.isRunnung; // false
_z.timer.stopAll();
timer1.isRunnung; // false
timer2.isRunnung; // false
timer1.remove(true);
_z.timer.startAll();
timer1.isRunnung; // false
timer1.isReady(); // true
timer1.start();
timer1.isRunnung; // true
timer1.isReady(); // false
_z.timer.stopAll();
timer1.isRunnung; // true
timer1.isReady(); // false
timer1.stop();
timer1.isRunnung; // false
timer1.isReady(); // true
timer1.start();
timer1.isRunnung; // true
timer1.isReady(); // false
_z.timer.hold = true; // this will hold all timers even they were started
timer1.isRunnung; // false
timer1.isReady(); // false
_z.timer.hold = false;
timer1.isRunnung; // true
timer1.isReady(); // false
_z.timer.startAll(); // start all timers
_z.timer.stopAll(); // stop all timers
_z.timer.removeAll(); // stop & remove all timers