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

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.

主站蜘蛛池模板: 合山市| 灵山县| 自治县| 姚安县| 喀什市| 红原县| 当阳市| 开远市| 平塘县| 霍林郭勒市| 邯郸县| 四会市| 房产| 合川市| 安平县| 民县| 文昌市| 高陵县| 新乐市| 柘城县| 炉霍县| 北宁市| 象山县| 石家庄市| 阜新市| 集贤县| 响水县| 宜城市| 连江县| 本溪市| 凤山市| 马关县| 云龙县| 婺源县| 巴彦县| 行唐县| 安龙县| 湘乡市| 乌鲁木齐市| 湘西| 资源县|