1 // Container for timed events
3 rate
: 4 * 1000, // default loop delay in ms
4 loop
: 0, // Count how many times it's looped
5 things
: Array(), // functions to be called go into this array
6 update: function() { // calls all of the array functions
7 for ( var i
= 0, j
= timers
.things
.length
; i
< j
; i
++ ) {
10 if ( timers
.things
.length
) { // Don't bother if there's nothing to run
11 setTimeout(timers
.update
, timers
.rate
);
17 // Start the event timer
18 function startTimer() {
19 setTimeout(timers
.update
, timers
.rate
);
21 window
.addEventListener('load', startTimer
, false);