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

Deferred execution

One occasionally needs to defer the execution of a function. Traditional JavaScript uses timers for this purpose, with the well-known setTimeout and setInterval functions. Node introduces another perspective on defers, primarily as means of controlling the order in which a callback executes in relation to I/O events, as well as timer events properly.

As we saw earlier, managing timers is one of the main jobs of Node's event loop. Two types of deferred event sources that give a developer the ability to schedule callback executions to occur either before, or after, the processing of queued I/O events are process.nextTick and setImmediate. Let's look at those now.

主站蜘蛛池模板: 观塘区| 调兵山市| 西华县| 洞口县| 东港市| 保亭| 西充县| 桐庐县| 南岸区| 司法| 宜兰县| 昌江| 岳普湖县| 广元市| 五指山市| 琼海市| 腾冲县| 当雄县| 潞城市| 阳新县| 延安市| 都安| 神农架林区| 伊通| 万全县| 叙永县| 民勤县| 中阳县| 宁陕县| 南充市| 佳木斯市| 新乡县| 德庆县| 乌海市| 沧源| 浦城县| 肃北| 寿阳县| 海伦市| 扶绥县| 衡水市|