如何在JavaScript中进行REAL sleep()? [英] How to make a REAL sleep() in JavaScript?
本文介绍了如何在JavaScript中进行REAL sleep()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道有很多方法,比如setTimeout,但我只想要一个真实的。
I know there are many methods like setTimeout, but I just want a REAL one.
我用JavaScript编写编译器,我必须找到一种实现sleep()函数的方法。
我知道错误的循环方式,这不是我想要的。
I'm using JavaScript to write a compiler, and I have to find out a way to implement the sleep() function. I know that buggy loop way, it's not what I want.
谢谢。
推荐答案
从上面的答案我收集到你想要一个不会冻结浏览器并且不使用setTimeout的睡眠功能。
From the answers above i gather that you want a sleep function that doesnt freeze the browser and doesnt use setTimeout.
祝你好运,javascript是单线程的。 这是不可能的
Good luck with that, javascript is single threaded. This is NOT possible
这篇关于如何在JavaScript中进行REAL sleep()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文