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

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.

主站蜘蛛池模板: 田阳县| 阿勒泰市| 兰考县| 宁夏| 林芝县| 自贡市| 长岛县| 南投县| 云龙县| 吉首市| 麻城市| 巨鹿县| 丰都县| 苍南县| 镇坪县| 吉水县| 亚东县| 尚义县| 通河县| 镇平县| 徐州市| 文昌市| 伊金霍洛旗| 奇台县| 彩票| 广昌县| 岳阳市| 宁强县| 门源| 镶黄旗| 巴彦县| 长汀县| 新安县| 丹棱县| 边坝县| 屯门区| 西吉县| 屏东县| 巧家县| 田东县| 绍兴市|