事件:'message'


🌐 Event: 'message'

  • value <any> 传输的值

'message' 事件在工作线程调用 require('node:worker_threads').parentPort.postMessage() 时触发。有关更多详细信息,请参阅 port.on('message') 事件。

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

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

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