Skip to content

doc: fix worker example to receive message

require('worker_threads') is not an instance of EventEmitter. So once method would not be in it. The correct way to receive the message would be to attach a listener to the message event on the parentPort.

Also, there is no built-in event called workerMessage. This patch fixes it by referencing message event.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading