官术网_书友最值得收藏!

setImmediate

setImmediate is technically a member of the class of timers, along with setInterval and setTimeout . However, there is no sense of time associated with it — there is no number of milliseconds to wait for an argument to be sent.

This method is really more of a sibling to process.nextTick, differing in one very important way: while callbacks queued by nextTick will execute before I/O and timer events, callbacks queued by setImmediate will be called after I/O events.

The naming of these two methods is confusing: Node will actually run the function you give to nextTick before the one you pass to setImmediate.

This method does reflect the standard behavior of timers in that its invocation will return an object that can be passed to clearImmediate, cancelling your request to run your function later on in the same way clearTimeout cancels timers set with setTimeout.

主站蜘蛛池模板: 泗洪县| 商丘市| 武鸣县| 合水县| 景洪市| 龙里县| 朝阳市| 丰顺县| 沾化县| 陆良县| 伽师县| 昌乐县| 阿坝县| 惠州市| 昭苏县| 资兴市| 内黄县| 集贤县| 河池市| 抚顺市| 阳城县| 乌鲁木齐市| 翼城县| 正宁县| 太康县| 湘阴县| 博爱县| 桑植县| 伽师县| 井陉县| 哈密市| 收藏| 乌鲁木齐市| 营口市| 灵山县| 武宣县| 北流市| 老河口市| 应城市| 玛纳斯县| 东莞市|