
Untitled
By: a guest on
May 2nd, 2012 | syntax:
None | size: 1.04 KB | hits: 12 | expires: Never
javascript - multiple settimeouts in loop
function fnIterateGeocode(addressVariations) {
// read a file & do some stuff
// check for delay
fnDelay();
// if not end of file then Iterate
if (nextRecord.EOF != 'Y') {
setTimeout(function(){
fnIterateGeocode(addressVariations);
}
, 5000);
}
// if mode = STOP, then delay for 5 seconds and check again
function fnDelay(){
if(mode == 'STOP'){
setTimeout(function(){
}
, 5000);
fnDelay();
}
return;
}
return;
}
function fnDelay(){
if(mode == 'STOP'){
setTimeout(function(){
// It should be here
}
, 5000);
fnDelay(); // Not here
}
return;
}
function fnDelay(){
if(mode != 'STOP'){ fnIterateGeocode(); }
else { setTimeout(fnDelay,5000);
}