A function used to run a function n number of times over x milliseconds.
a= function if the function returns true, interval will stop b= duration in milliseconds defaults to 5000 c= number of times the function will run defaults to once per second
Example: setIntervalTimer(function(){console.log("TEST 1")}); setIntervalTimer(function(){console.log("TEST 2")},4000); setIntervalTimer(function(){console.log("TEST 3")},4000,10);
var setIntervalTimer = function(a,b,c){
if(typeof(b)=="undefined"){var b = 5000}//default to 5 seconds
if(typeof(c)=="undefined"){var c = b>=1000? b/1000 : 1;}// defaults to once per second
var tempInterval = setInterval(function() {if(a()){clearInterval(tempInterval);};}, b/c);
setTimeout(function(){ clearInterval(tempInterval);}, b);
}