process.channel.ref()
如果之前已调用过 .unref()
,则此方法使 IPC 通道保持进程的事件循环运行。
通常,这是通过 process
对象上的 'disconnect'
和 'message'
监听器的数量来管理的。
但是,此方法可用于显式请求特定行为。
This method makes the IPC channel keep the event loop of the process
running if .unref()
has been called before.
Typically, this is managed through the number of 'disconnect'
and 'message'
listeners on the process
object. However, this method can be used to
explicitly request a specific behavior.