完成异步功能时,在NodeJS中断开While循环[重复]
这个问题在这里已有答案:
- Limited number of javascript promises is not working if running in infinite loop 1回答
如果您只想记录一次processing...
,我会将代码更改为以下代码。
var statuslogged = false;
while (true) {
if (!statuslogged) {
console.log('processing...');
statuslogged = true;
}
if (asyncdone) {
console.log(result)
}
}
与本文相关的文章
评论列表(0)
- 暂无评论