我正在为个人需求开发一个控制台脚本.我需要能够暂停更长的时间,但是,根据我的研究, node .js无法按要求停止.经过一段时间后,阅读用户信息变得越来越困难...我见过一些代码,但我相信他们必须有其他代码才能工作,比如:
setTimeout(function() {
}, 3000);
但是,我需要此行代码之后的所有内容在一段时间后执行.
例如,
// start of code
console.log('Welcome to my console,');
some-wait-code-here-for-ten-seconds...
console.log('Blah blah blah blah extra-blah');
// end of code
我也见过类似的事情
yield sleep(2000);
但是 node .js没有意识到这一点.
我如何才能实现这种延长的停顿?