Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
doc: fix worker example to receive message#21486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
thefourtheye commented Jun 23, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot commented Jun 23, 2018
doc/api/worker_threads.md Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case the norm is to link worker_threads.parentPort and 'message' separately, to something like
received via [`worker_threads.parentPort`][]'s [`'message'`][`port.on('message')`] event.vssenko commented Jun 29, 2018
Wow, luckly i found this issue, helped a lot. But documentation is still invalid. |
addaleax commented Jul 9, 2018
@thefourtheye Can you rebase this? |
jasnell commented Jul 12, 2018
ping @thefourtheye |
f80beff to 9bc522dCompare`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`.9bc522d to d1b0121Comparethefourtheye commented Jul 17, 2018
addaleax commented Jul 18, 2018
`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: nodejs#21486 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>BridgeAR commented Jul 18, 2018
Landed in 42be4c3 🎉 |
`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: #21486 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
require('worker_threads')is not an instance ofEventEmitter. Sooncemethod would not be in it. The correct way to receive the messagewould be to attach a listener to the
messageevent on theparentPort.Also, there is no built-in event called
workerMessage. This patchfixes it by referencing
messageevent.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes