我用setInterval(fname, 10000);JavaScript在JavaScript中每10秒调用一次函数.是否有可能在某些事件上停止调用它?
我希望用户能够停止重复刷新数据.
如果条件正确,我需要退出运行间隔:
var refreshId = setInterval(function() {
var properID = CheckReload();
if (properID > 0) {
<--- exit from the loop--->
}
}, 10000);
Run Code Online (Sandbox Code Playgroud)