类别:Immediate


【Class: Immediate

该对象是内部创建的,并从 setImmediate() 返回。它可以传递给 clearImmediate(),以取消已安排的操作。

【This object is created internally and is returned from setImmediate(). It can be passed to clearImmediate() in order to cancel the scheduled actions.】

默认情况下,当一个 immediate 被调度时,只要该 immediate 处于活动状态,Node.js 事件循环将继续运行。setImmediate() 导出的 Immediate 对象返回了 immediate.ref()immediate.unref() 函数,可用于控制此默认行为。

【By default, when an immediate is scheduled, the Node.js event loop will continue running as long as the immediate is active. The Immediate object returned by setImmediate() exports both immediate.ref() and immediate.unref() functions that can be used to control this default behavior.】