@@ -53,7 +53,7 @@ When implementing a worker pool, use the [`AsyncResource`][] API to inform
53
53
diagnostic tools (e.g. in order to provide asynchronous stack traces) about the
54
54
correlation between tasks and their outcomes.
55
55
56
- ## worker.isMainThread
56
+ ## ` worker.isMainThread `
57
57
<!-- YAML
58
58
added: v10.5.0
59
59
-->
@@ -74,7 +74,7 @@ if (isMainThread) {
74
74
}
75
75
```
76
76
77
- ## worker.moveMessagePortToContext(port, contextifiedSandbox)
77
+ ## ` worker.moveMessagePortToContext(port, contextifiedSandbox) `
78
78
<!-- YAML
79
79
added: v11.13.0
80
80
-->
@@ -98,7 +98,7 @@ However, the created `MessagePort` will no longer inherit from
98
98
[ ` EventEmitter ` ] [ ] , and only [ ` port.onmessage() ` ] [ ] can be used to receive
99
99
events using it.
100
100
101
- ## worker.parentPort
101
+ ## ` worker.parentPort `
102
102
<!-- YAML
103
103
added: v10.5.0
104
104
-->
@@ -129,7 +129,7 @@ if (isMainThread) {
129
129
}
130
130
```
131
131
132
- ## worker.receiveMessageOnPort(port)
132
+ ## ` worker.receiveMessageOnPort(port) `
133
133
<!-- YAML
134
134
added: v12.3.0
135
135
-->
@@ -157,7 +157,7 @@ console.log(receiveMessageOnPort(port2));
157
157
When this function is used, no ` 'message' ` event will be emitted and the
158
158
` onmessage ` listener will not be invoked.
159
159
160
- ## worker.SHARE_ENV
160
+ ## ` worker.SHARE_ENV `
161
161
<!-- YAML
162
162
added: v11.14.0
163
163
-->
@@ -176,7 +176,7 @@ new Worker('process.env.SET_IN_WORKER = "foo"', { eval: true, env: SHARE_ENV })
176
176
});
177
177
```
178
178
179
- ## worker.threadId
179
+ ## ` worker.threadId `
180
180
<!-- YAML
181
181
added: v10.5.0
182
182
-->
@@ -187,7 +187,7 @@ An integer identifier for the current thread. On the corresponding worker object
187
187
(if there is any), it is available as [ ` worker.threadId ` ] [ ] .
188
188
This value is unique for each [ ` Worker ` ] [ ] instance inside a single process.
189
189
190
- ## worker.workerData
190
+ ## ` worker.workerData `
191
191
<!-- YAML
192
192
added: v10.5.0
193
193
-->
@@ -208,7 +208,7 @@ if (isMainThread) {
208
208
}
209
209
```
210
210
211
- ## Class: MessageChannel
211
+ ## Class: ` MessageChannel `
212
212
<!-- YAML
213
213
added: v10.5.0
214
214
-->
@@ -228,7 +228,7 @@ port2.postMessage({ foo: 'bar' });
228
228
// Prints: received { foo: 'bar' } from the `port1.on('message')` listener
229
229
```
230
230
231
- ## Class: MessagePort
231
+ ## Class: ` MessagePort `
232
232
<!-- YAML
233
233
added: v10.5.0
234
234
-->
@@ -243,7 +243,7 @@ structured data, memory regions and other `MessagePort`s between different
243
243
With the exception of ` MessagePort ` s being [ ` EventEmitter ` ] [ ] s rather
244
244
than [ ` EventTarget ` ] [ ] s, this implementation matches [ browser ` MessagePort ` ] [ ] s.
245
245
246
- ### Event: 'close'
246
+ ### Event: ` 'close' `
247
247
<!-- YAML
248
248
added: v10.5.0
249
249
-->
@@ -265,7 +265,7 @@ port1.postMessage('foobar');
265
265
port1 .close ();
266
266
```
267
267
268
- ### Event: 'message'
268
+ ### Event: ` 'message' `
269
269
<!-- YAML
270
270
added: v10.5.0
271
271
-->
@@ -278,7 +278,7 @@ input of [`port.postMessage()`][].
278
278
Listeners on this event will receive a clone of the ` value ` parameter as passed
279
279
to ` postMessage() ` and no further arguments.
280
280
281
- ### port.close()
281
+ ### ` port.close() `
282
282
<!-- YAML
283
283
added: v10.5.0
284
284
-->
@@ -290,7 +290,7 @@ This method can be called when no further communication will happen over this
290
290
The [ ` 'close' ` event] [ ] will be emitted on both ` MessagePort ` instances that
291
291
are part of the channel.
292
292
293
- ### port.postMessage(value\ [ , transferList\] )
293
+ ### ` port.postMessage(value[, transferList]) `
294
294
<!-- YAML
295
295
added: v10.5.0
296
296
-->
@@ -371,7 +371,7 @@ posting without having side effects.
371
371
For more information on the serialization and deserialization mechanisms
372
372
behind this API, see the [ serialization API of the ` v8 ` module] [ v8.serdes ] .
373
373
374
- ### port.ref()
374
+ ### ` port.ref() `
375
375
<!-- YAML
376
376
added: v10.5.0
377
377
-->
@@ -384,7 +384,7 @@ If listeners are attached or removed using `.on('message')`, the port will
384
384
be ` ref() ` ed and ` unref() ` ed automatically depending on whether
385
385
listeners for the event exist.
386
386
387
- ### port.start()
387
+ ### ` port.start() `
388
388
<!-- YAML
389
389
added: v10.5.0
390
390
-->
@@ -399,7 +399,7 @@ Node.js also diverges in its handling of `.onmessage`. Setting it will
399
399
automatically call ` .start() ` , but unsetting it will let messages queue up
400
400
until a new handler is set or the port is discarded.
401
401
402
- ### port.unref()
402
+ ### ` port.unref() `
403
403
<!-- YAML
404
404
added: v10.5.0
405
405
-->
@@ -412,7 +412,7 @@ If listeners are attached or removed using `.on('message')`, the port will
412
412
be ` ref() ` ed and ` unref() ` ed automatically depending on whether
413
413
listeners for the event exist.
414
414
415
- ## Class: Worker
415
+ ## Class: ` Worker `
416
416
<!-- YAML
417
417
added: v10.5.0
418
418
-->
@@ -487,7 +487,7 @@ if (isMainThread) {
487
487
}
488
488
```
489
489
490
- ### new Worker(filename\ [ , options\] )
490
+ ### ` new Worker(filename[, options]) `
491
491
492
492
* ` filename ` {string} The path to the Worker’s main script. Must be
493
493
either an absolute path or a relative path (i.e. relative to the
@@ -520,7 +520,7 @@ if (isMainThread) {
520
520
will be thrown if the object cannot be cloned (e.g. because it contains
521
521
` function ` s).
522
522
523
- ### Event: 'error'
523
+ ### Event: ` 'error' `
524
524
<!-- YAML
525
525
added: v10.5.0
526
526
-->
@@ -530,7 +530,7 @@ added: v10.5.0
530
530
The ` 'error' ` event is emitted if the worker thread throws an uncaught
531
531
exception. In that case, the worker will be terminated.
532
532
533
- ### Event: 'exit'
533
+ ### Event: ` 'exit' `
534
534
<!-- YAML
535
535
added: v10.5.0
536
536
-->
@@ -542,7 +542,7 @@ exited by calling [`process.exit()`][], the `exitCode` parameter will be the
542
542
passed exit code. If the worker was terminated, the ` exitCode ` parameter will
543
543
be ` 1 ` .
544
544
545
- ### Event: 'message'
545
+ ### Event: ` 'message' `
546
546
<!-- YAML
547
547
added: v10.5.0
548
548
-->
@@ -553,15 +553,15 @@ The `'message'` event is emitted when the worker thread has invoked
553
553
[ ` require('worker_threads').parentPort.postMessage() ` ] [ ] .
554
554
See the [ ` port.on('message') ` ] [ ] event for more details.
555
555
556
- ### Event: 'online'
556
+ ### Event: ` 'online' `
557
557
<!-- YAML
558
558
added: v10.5.0
559
559
-->
560
560
561
561
The ` 'online' ` event is emitted when the worker thread has started executing
562
562
JavaScript code.
563
563
564
- ### worker.postMessage(value\ [ , transferList\] )
564
+ ### ` worker.postMessage(value[, transferList]) `
565
565
<!-- YAML
566
566
added: v10.5.0
567
567
-->
@@ -573,7 +573,7 @@ Send a message to the worker that will be received via
573
573
[ ` require('worker_threads').parentPort.on('message') ` ] [ ] .
574
574
See [ ` port.postMessage() ` ] [ ] for more details.
575
575
576
- ### worker.ref()
576
+ ### ` worker.ref() `
577
577
<!-- YAML
578
578
added: v10.5.0
579
579
-->
@@ -583,7 +583,7 @@ Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker will
583
583
behavior). If the worker is ` ref() ` ed, calling ` ref() ` again will have
584
584
no effect.
585
585
586
- ### worker.stderr
586
+ ### ` worker.stderr `
587
587
<!-- YAML
588
588
added: v10.5.0
589
589
-->
@@ -595,7 +595,7 @@ inside the worker thread. If `stderr: true` was not passed to the
595
595
[ ` Worker ` ] [ ] constructor, then data will be piped to the parent thread's
596
596
[ ` process.stderr ` ] [ ] stream.
597
597
598
- ### worker.stdin
598
+ ### ` worker.stdin `
599
599
<!-- YAML
600
600
added: v10.5.0
601
601
-->
@@ -606,7 +606,7 @@ If `stdin: true` was passed to the [`Worker`][] constructor, this is a
606
606
writable stream. The data written to this stream will be made available in
607
607
the worker thread as [ ` process.stdin ` ] [ ] .
608
608
609
- ### worker.stdout
609
+ ### ` worker.stdout `
610
610
<!-- YAML
611
611
added: v10.5.0
612
612
-->
@@ -618,7 +618,7 @@ inside the worker thread. If `stdout: true` was not passed to the
618
618
[ ` Worker ` ] [ ] constructor, then data will be piped to the parent thread's
619
619
[ ` process.stdout ` ] [ ] stream.
620
620
621
- ### worker.terminate()
621
+ ### ` worker.terminate() `
622
622
<!-- YAML
623
623
added: v10.5.0
624
624
changes:
@@ -636,7 +636,7 @@ Stop all JavaScript execution in the worker thread as soon as possible.
636
636
Returns a Promise for the exit code that is fulfilled when the
637
637
[ ` 'exit' ` event] [ ] is emitted.
638
638
639
- ### worker.threadId
639
+ ### ` worker.threadId `
640
640
<!-- YAML
641
641
added: v10.5.0
642
642
-->
@@ -647,7 +647,7 @@ An integer identifier for the referenced thread. Inside the worker thread,
647
647
it is available as [ ` require('worker_threads').threadId ` ] [ ] .
648
648
This value is unique for each ` Worker ` instance inside a single process.
649
649
650
- ### worker.unref()
650
+ ### ` worker.unref() `
651
651
<!-- YAML
652
652
added: v10.5.0
653
653
-->
0 commit comments