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

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.

主站蜘蛛池模板: 荆门市| 安龙县| 宁陵县| 苍梧县| 黄陵县| 藁城市| 方山县| 辽阳市| 丹阳市| 通州市| 哈尔滨市| 深圳市| 元阳县| 福海县| 榆中县| 资兴市| 巴彦淖尔市| 齐齐哈尔市| 昌吉市| 丽水市| 双柏县| 鄂伦春自治旗| 南宫市| 甘肃省| 齐齐哈尔市| 昂仁县| 巴彦县| 南川市| 洛川县| 屯留县| 且末县| 泰顺县| 河池市| 镇平县| 湄潭县| 新绛县| 文化| 常熟市| 泰宁县| 平阳县| 阳谷县|