'message' 事件


当工作线程调用 require('worker_threads').parentPort.postMessage() 时,则会触发 'message' 事件。 详情请见 port.on('message') 事件。

从工作线程发送的所有消息都将在 Worker 对象上触发 'exit' 事件之前触发。

  • value <any> The transmitted value

The 'message' event is emitted when the worker thread has invoked require('worker_threads').parentPort.postMessage(). See the port.on('message') event for more details.

All messages sent from the worker thread will be emitted before the 'exit' event is emitted on the Worker object.