var timers = function() { var timers = []; var timeouts = []; return { 'addTimer': function(interval, callback) { // Because who puts the callback first. Really. timers.push(setInterval(callback, interval)); }, 'addOnceTimer': function(delay, callback) { // Because who seriously puts the callback first here too? timeouts.push(setTimeout(callback, delay)); }, 'clearTimers': function() { for(var i;i