繁体   English   中英

异步 function 使用 es5

[英]Async function using es5

我有以下代码:

var fired = false;
function markTrue() {
    fired = true;
}
setTimeout(checkPurchase, 1000);
if (fired == false) setTimeout(markTrue, 2000);
if (fired == false) setTimeout(markTrue, 4000);

如何在1000 milliseconds and 4000 毫秒后检查if fired == false 现在它正在立即检查,所以火总是false

代码应该在 ES5 中,因为它将在 Google 标签管理器上运行。

我有以下代码:

var fired = false;
function markTrue() {
    fired = true;
}
setTimeout(checkPurchase, 1000);
if (fired == false) setTimeout(markTrue, 2000);
if (fired == false) setTimeout(markTrue, 4000);

如何在1000 milliseconds and 4000 毫秒后检查if fired == false 现在它正在立即检查,所以火总是false

代码应该在 ES5 中,因为它将在 Google 标签管理器上运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM