nextTick 是否意味着 Node.js(事件循环)的下一阶段? [英] Does nextTick means next phase in Node.js (Event Loop)?
本文介绍了nextTick 是否意味着 Node.js(事件循环)的下一阶段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
process.nextTick
到底是什么意思?
nextTick
是否意味着,在当前阶段的一个元素的回调队列弹出后?或者在执行当前阶段队列中的所有回调之后进入下一阶段之前?
Does nextTick
mean, after callback queue pop for one element in the current phase ? Or before moving to the next phase after executing all callbacks in the current phase's queue ?
推荐答案
这在 the文档.
nextTick
将要在当前刻度结束时调用的回调排队.整个队列在移动到下一个滴答之前被清空.
nextTick
queues callbacks to be invoked at the end of the current tick. The entire queue is emptied before moving to the next tick.
与 setImmediate
对比,后者将回调排队到在下一个勾号期间调用.
(是的,名称具有误导性,但它们的行为是为了保持兼容性.)
(Yes, the names are misleading, but their behavior is that way to keep compatibility.)
这篇关于nextTick 是否意味着 Node.js(事件循环)的下一阶段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文