I'm doing a function to check a certain iteration and if it goes from x I pause the contactor, but it is not working, it continues to pop up alert window, follow my example below?
function verificaComplet(tam, page){
var tentativas = 0,
maxRange = tam + 5,
time;
console.log("max Range " + maxRange);
console.log("iteracoes " + iteracoes);
iteracoes = iteracoes + 1;
if(maxRange > iteracoes){
if(w_variavel == tam){
activate_page(page);
desbloqueiTela("#BloqueiaLogin");
}else{
time = setTimeout(function () { verificaComplet(tam, page);}, 5000);
}
}else{
clearTimeout(time);
desbloqueiTela("#BloqueiaLogin");
alert("Tempo de espera escedido, Por favor tente novamente mais tarde.");
}
}
The output of the program is as follows:
max Range 22 VM2450 main.js:608
iteracoes 17 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 18 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 19 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 20 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 21 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 22 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 23 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 24 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 25 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 26 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 27 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 28 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 29 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 30 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 31 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 32 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 33 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 34 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 35 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 36 VM2450 main.js:609
max Range 22 VM2450 main.js:608
iteracoes 37 VM2450 main.js:609