setImmediate vs. nextTick

后端 未结 7 741
野的像风
野的像风 2020-11-22 12:26

Node.js version 0.10 was released today and introduced setImmediate. The API changes documentation suggests using it when doing recursive nextTick

7条回答
  •  执念已碎
    2020-11-22 13:10

    In the comments in the answer, it does not explicitly state that nextTick shifted from Macrosemantics to Microsemantics.

    before node 0.9 (when setImmediate was introduced), nextTick operated at the start of the next callstack.

    since node 0.9, nextTick operates at the end of the existing callstack, whereas setImmediate is at the start of the next callstack

    check out https://github.com/YuzuJS/setImmediate for tools and details

提交回复
热议问题