doc: improve worker_threads documentation#26110
doc: improve worker_threads documentation#26110addaleax wants to merge 4 commits intonodejs:masterfrom
Conversation
This adds a few examples and clarifications.
| This method can be called when no further communication will happen over this | ||
| `MessagePort`. | ||
|
|
||
| The [`'close'` event][] will be emitted on both `MessagePort` instances that |
There was a problem hiding this comment.
Might be I'm over-reacting to passive voice, but perhaps this?:
Both `MessagePort` instances that are part of the channel will emit a [`'close'` event][].There was a problem hiding this comment.
I have to admit that active voice sounds a bit weird to me when referring to events :)
Trott
left a comment
There was a problem hiding this comment.
Left two completely-optional totally-ignorable comment/suggestions, but LGTM as-is.
| @@ -91,6 +120,16 @@ added: v10.5.0 | |||
| An arbitrary JavaScript value that contains a clone of the data passed | |||
There was a problem hiding this comment.
It might be good to include more of a description of what "clone" here means in general. I know there are a few bits and pieces of an explanation through the doc, but coalescing those into a single section with some information on what types of values cannot be cloned, would be good.
| The `worker_threads` module enables the use of threads with message channels | ||
| between them. To access it: | ||
| The `worker_threads` module enables the use of threads that execute JS code | ||
| in parallel. To access it: |
There was a problem hiding this comment.
Maybe something more like "that allow parallel execution contexts for JS code"?
There was a problem hiding this comment.
@Fishrock123 I’m not sure … “execution context” sounds like a very generic thing?
|
Landed in 70a500f |
This adds a few examples and clarifications. PR-URL: #26110 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
This adds a few examples and clarifications. PR-URL: #26110 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
This adds a few examples and clarifications. PR-URL: #26110 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
This adds a few examples and clarifications.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes