我有一个在jQuery插件中调用的setInterval(),但我想从我的主页清除它,我无法访问存储setInterval的变量。有没有办法清除页面上的所有计时器? 最佳答案 这可以是清除所有间隔的逻辑之一...for(vari=1;i 关于javascript-我怎样才能为所有setInterval()clearInterval()?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/question
bigloop=setInterval(function(){varchecked=$('#status_tabletr[id^="monitor_"]:checked');if(checked.index()===-1||checked.length===0||){bigloop=clearInterval(bigloop);$('#monitor').button('enable');}else{(functionloop(i){//monitorelementatindeximonitoring($(checked[i]).parents('tr'));//delayof3sec
bigloop=setInterval(function(){varchecked=$('#status_tabletr[id^="monitor_"]:checked');if(checked.index()===-1||checked.length===0||){bigloop=clearInterval(bigloop);$('#monitor').button('enable');}else{(functionloop(i){//monitorelementatindeximonitoring($(checked[i]).parents('tr'));//delayof3sec
我有一段Javascript每隔n秒检查一次条件(通过AJAX调用)。如果该条件为真,它将停止检查。我已经通过以下方式实现了它:varstopTimer;vartimerId=setInterval(function(){/*MakeAjaxCallsandsetstopTimer*/if(stopTimer){clearInterval(timerId);}},10000);但是,我发现了不稳定的行为:有时有效,但在其他时候,它会一直检查。我已经检查过(尽可能多地)代码的任何部分都没有错误。因此,我怀疑在setInterval处理程序中调用clearInterval可能是罪魁祸首。那
这是我在nodeJS中的JS:functiontest(a,room,seconds){console.log(a,room,seconds);}intervalid=setInterval(test,1000,'room',20);console.log('intervalid',intervalid);返回输出:intervalidTimeout{_called:false,_idleTimeout:1000,_idlePrev:TimersList{_idleNext:[Circular],_idlePrev:[Circular],_timer:Timer{'0':[Functi