@@ -53,7 +53,7 @@ When implementing a worker pool, use the [`AsyncResource`][] API to inform
5353diagnostic tools (e.g. in order to provide asynchronous stack traces) about the
5454correlation between tasks and their outcomes.
5555
56- ## worker.isMainThread
56+ ## ` worker.isMainThread `
5757<!-- YAML
5858added: v10.5.0
5959-->
@@ -74,7 +74,7 @@ if (isMainThread) {
7474}
7575```
7676
77- ## worker.moveMessagePortToContext(port, contextifiedSandbox)
77+ ## ` worker.moveMessagePortToContext(port, contextifiedSandbox) `
7878<!-- YAML
7979added: v11.13.0
8080-->
@@ -98,7 +98,7 @@ However, the created `MessagePort` will no longer inherit from
9898[ ` EventEmitter ` ] [ ] , and only [ ` port.onmessage() ` ] [ ] can be used to receive
9999events using it.
100100
101- ## worker.parentPort
101+ ## ` worker.parentPort `
102102<!-- YAML
103103added: v10.5.0
104104-->
@@ -129,7 +129,7 @@ if (isMainThread) {
129129}
130130```
131131
132- ## worker.receiveMessageOnPort(port)
132+ ## ` worker.receiveMessageOnPort(port) `
133133<!-- YAML
134134added: v12.3.0
135135-->
@@ -157,7 +157,7 @@ console.log(receiveMessageOnPort(port2));
157157When this function is used, no ` 'message' ` event will be emitted and the
158158` onmessage ` listener will not be invoked.
159159
160- ## worker.SHARE_ENV
160+ ## ` worker.SHARE_ENV `
161161<!-- YAML
162162added: v11.14.0
163163-->
@@ -176,7 +176,7 @@ new Worker('process.env.SET_IN_WORKER = "foo"', { eval: true, env: SHARE_ENV })
176176 });
177177```
178178
179- ## worker.threadId
179+ ## ` worker.threadId `
180180<!-- YAML
181181added: v10.5.0
182182-->
@@ -187,7 +187,7 @@ An integer identifier for the current thread. On the corresponding worker object
187187(if there is any), it is available as [ ` worker.threadId ` ] [ ] .
188188This value is unique for each [ ` Worker ` ] [ ] instance inside a single process.
189189
190- ## worker.workerData
190+ ## ` worker.workerData `
191191<!-- YAML
192192added: v10.5.0
193193-->
@@ -208,7 +208,7 @@ if (isMainThread) {
208208}
209209```
210210
211- ## Class: MessageChannel
211+ ## Class: ` MessageChannel `
212212<!-- YAML
213213added: v10.5.0
214214-->
@@ -228,7 +228,7 @@ port2.postMessage({ foo: 'bar' });
228228// Prints: received { foo: 'bar' } from the `port1.on('message')` listener
229229```
230230
231- ## Class: MessagePort
231+ ## Class: ` MessagePort `
232232<!-- YAML
233233added: v10.5.0
234234-->
@@ -243,7 +243,7 @@ structured data, memory regions and other `MessagePort`s between different
243243With the exception of ` MessagePort ` s being [ ` EventEmitter ` ] [ ] s rather
244244than [ ` EventTarget ` ] [ ] s, this implementation matches [ browser ` MessagePort ` ] [ ] s.
245245
246- ### Event: 'close'
246+ ### Event: ` 'close' `
247247<!-- YAML
248248added: v10.5.0
249249-->
@@ -265,7 +265,7 @@ port1.postMessage('foobar');
265265port1 .close ();
266266```
267267
268- ### Event: 'message'
268+ ### Event: ` 'message' `
269269<!-- YAML
270270added: v10.5.0
271271-->
@@ -278,7 +278,7 @@ input of [`port.postMessage()`][].
278278Listeners on this event will receive a clone of the ` value ` parameter as passed
279279to ` postMessage() ` and no further arguments.
280280
281- ### port.close()
281+ ### ` port.close() `
282282<!-- YAML
283283added: v10.5.0
284284-->
@@ -290,7 +290,7 @@ This method can be called when no further communication will happen over this
290290The [ ` 'close' ` event] [ ] will be emitted on both ` MessagePort ` instances that
291291are part of the channel.
292292
293- ### port.postMessage(value\ [ , transferList\] )
293+ ### ` port.postMessage(value[, transferList]) `
294294<!-- YAML
295295added: v10.5.0
296296-->
@@ -371,7 +371,7 @@ posting without having side effects.
371371For more information on the serialization and deserialization mechanisms
372372behind this API, see the [ serialization API of the ` v8 ` module] [ v8.serdes ] .
373373
374- ### port.ref()
374+ ### ` port.ref() `
375375<!-- YAML
376376added: v10.5.0
377377-->
@@ -384,7 +384,7 @@ If listeners are attached or removed using `.on('message')`, the port will
384384be ` ref() ` ed and ` unref() ` ed automatically depending on whether
385385listeners for the event exist.
386386
387- ### port.start()
387+ ### ` port.start() `
388388<!-- YAML
389389added: v10.5.0
390390-->
@@ -399,7 +399,7 @@ Node.js also diverges in its handling of `.onmessage`. Setting it will
399399automatically call ` .start() ` , but unsetting it will let messages queue up
400400until a new handler is set or the port is discarded.
401401
402- ### port.unref()
402+ ### ` port.unref() `
403403<!-- YAML
404404added: v10.5.0
405405-->
@@ -412,7 +412,7 @@ If listeners are attached or removed using `.on('message')`, the port will
412412be ` ref() ` ed and ` unref() ` ed automatically depending on whether
413413listeners for the event exist.
414414
415- ## Class: Worker
415+ ## Class: ` Worker `
416416<!-- YAML
417417added: v10.5.0
418418-->
@@ -487,7 +487,7 @@ if (isMainThread) {
487487}
488488```
489489
490- ### new Worker(filename\ [ , options\] )
490+ ### ` new Worker(filename[, options]) `
491491
492492* ` filename ` {string} The path to the Worker’s main script. Must be
493493 either an absolute path or a relative path (i.e. relative to the
@@ -520,7 +520,7 @@ if (isMainThread) {
520520 will be thrown if the object cannot be cloned (e.g. because it contains
521521 ` function ` s).
522522
523- ### Event: 'error'
523+ ### Event: ` 'error' `
524524<!-- YAML
525525added: v10.5.0
526526-->
@@ -530,7 +530,7 @@ added: v10.5.0
530530The ` 'error' ` event is emitted if the worker thread throws an uncaught
531531exception. In that case, the worker will be terminated.
532532
533- ### Event: 'exit'
533+ ### Event: ` 'exit' `
534534<!-- YAML
535535added: v10.5.0
536536-->
@@ -542,7 +542,7 @@ exited by calling [`process.exit()`][], the `exitCode` parameter will be the
542542passed exit code. If the worker was terminated, the ` exitCode ` parameter will
543543be ` 1 ` .
544544
545- ### Event: 'message'
545+ ### Event: ` 'message' `
546546<!-- YAML
547547added: v10.5.0
548548-->
@@ -553,15 +553,15 @@ The `'message'` event is emitted when the worker thread has invoked
553553[ ` require('worker_threads').parentPort.postMessage() ` ] [ ] .
554554See the [ ` port.on('message') ` ] [ ] event for more details.
555555
556- ### Event: 'online'
556+ ### Event: ` 'online' `
557557<!-- YAML
558558added: v10.5.0
559559-->
560560
561561The ` 'online' ` event is emitted when the worker thread has started executing
562562JavaScript code.
563563
564- ### worker.postMessage(value\ [ , transferList\] )
564+ ### ` worker.postMessage(value[, transferList]) `
565565<!-- YAML
566566added: v10.5.0
567567-->
@@ -573,7 +573,7 @@ Send a message to the worker that will be received via
573573[ ` require('worker_threads').parentPort.on('message') ` ] [ ] .
574574See [ ` port.postMessage() ` ] [ ] for more details.
575575
576- ### worker.ref()
576+ ### ` worker.ref() `
577577<!-- YAML
578578added: v10.5.0
579579-->
@@ -583,7 +583,7 @@ Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker will
583583behavior). If the worker is ` ref() ` ed, calling ` ref() ` again will have
584584no effect.
585585
586- ### worker.stderr
586+ ### ` worker.stderr `
587587<!-- YAML
588588added: v10.5.0
589589-->
@@ -595,7 +595,7 @@ inside the worker thread. If `stderr: true` was not passed to the
595595[ ` Worker ` ] [ ] constructor, then data will be piped to the parent thread's
596596[ ` process.stderr ` ] [ ] stream.
597597
598- ### worker.stdin
598+ ### ` worker.stdin `
599599<!-- YAML
600600added: v10.5.0
601601-->
@@ -606,7 +606,7 @@ If `stdin: true` was passed to the [`Worker`][] constructor, this is a
606606writable stream. The data written to this stream will be made available in
607607the worker thread as [ ` process.stdin ` ] [ ] .
608608
609- ### worker.stdout
609+ ### ` worker.stdout `
610610<!-- YAML
611611added: v10.5.0
612612-->
@@ -618,7 +618,7 @@ inside the worker thread. If `stdout: true` was not passed to the
618618[ ` Worker ` ] [ ] constructor, then data will be piped to the parent thread's
619619[ ` process.stdout ` ] [ ] stream.
620620
621- ### worker.terminate()
621+ ### ` worker.terminate() `
622622<!-- YAML
623623added: v10.5.0
624624changes:
@@ -636,7 +636,7 @@ Stop all JavaScript execution in the worker thread as soon as possible.
636636Returns a Promise for the exit code that is fulfilled when the
637637[ ` 'exit' ` event] [ ] is emitted.
638638
639- ### worker.threadId
639+ ### ` worker.threadId `
640640<!-- YAML
641641added: v10.5.0
642642-->
@@ -647,7 +647,7 @@ An integer identifier for the referenced thread. Inside the worker thread,
647647it is available as [ ` require('worker_threads').threadId ` ] [ ] .
648648This value is unique for each ` Worker ` instance inside a single process.
649649
650- ### worker.unref()
650+ ### ` worker.unref() `
651651<!-- YAML
652652added: v10.5.0
653653-->
0 commit comments