doc: fix worker example to receive message
`require('worker_threads')` is not an instance of `EventEmitter`. So
`on` 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`.
PR-URL: https://github.com/nodejs/node/pull/21486
Reviewed-By:
Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By:
Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By:
James M Snell <jasnell@gmail.com>
Reviewed-By:
Colin Ihrig <cjihrig@gmail.com>
Reviewed-By:
Anna Henningsen <anna@addaleax.net>
Reviewed-By:
Ruben Bridgewater <ruben@bridgewater.de>
parent
39902e28
Please register or sign in to comment