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

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.

主站蜘蛛池模板: 临城县| 苗栗市| 莲花县| 木里| 阿瓦提县| 茌平县| 吉林市| 教育| 宣化县| 陵川县| 赫章县| 怀宁县| 十堰市| 玉田县| 潼关县| 舞阳县| 突泉县| 大方县| 武隆县| 安国市| 乐陵市| 胶南市| 平江县| 桓台县| 新郑市| 普陀区| 安泽县| 九江市| 金秀| 当阳市| 安义县| 米泉市| 永康市| 泰来县| 阿勒泰市| 游戏| 万年县| 兴宁市| 漾濞| 鄂托克旗| 秦安县|