Is it possible to do setInterval, then after 180 times it runs, slow down the interval time?
Basically after about 15 minutes I would like the timer to only run once every minute, then after about an hour set the interval to run once every hour. I am hoping that there is a way I can do this without having to embed a setInterval within a setInterval within a setInterval.
var c = 0;
var interval = 5000;
var timer;
timer = setInterval(function(){
checkActivity();
c++;
if(c > 180){
interval = 60000;
}
}, interval);
Try something like this: