| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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.resourceLimits | ||
| 160 | + ## `worker.resourceLimits` | ||
| 161 | 161 | <!-- YAML | |
| 162 | 162 | added: v13.2.0 | |
| 163 | 163 | --> | |
@@ -173,7 +173,7 @@ this matches its values. | |||
| 173 | 173 | ||
| 174 | 174 | If this is used in the main thread, its value is an empty object. | |
| 175 | 175 | ||
| 176 | - ## worker.SHARE_ENV | ||
| 176 | + ## `worker.SHARE_ENV` | ||
| 177 | 177 | <!-- YAML | |
| 178 | 178 | added: v11.14.0 | |
| 179 | 179 | --> | |
@@ -192,7 +192,7 @@ new Worker('process.env.SET_IN_WORKER = "foo"', { eval: true, env: SHARE_ENV }) | |||
| 192 | 192 | }); | |
| 193 | 193 | ``` | |
| 194 | 194 | ||
| 195 | - ## worker.threadId | ||
| 195 | + ## `worker.threadId` | ||
| 196 | 196 | <!-- YAML | |
| 197 | 197 | added: v10.5.0 | |
| 198 | 198 | --> | |
@@ -203,7 +203,7 @@ An integer identifier for the current thread. On the corresponding worker object | |||
| 203 | 203 | (if there is any), it is available as [`worker.threadId`][]. | |
| 204 | 204 | This value is unique for each [`Worker`][] instance inside a single process. | |
| 205 | 205 | ||
| 206 | - ## worker.workerData | ||
| 206 | + ## `worker.workerData` | ||
| 207 | 207 | <!-- YAML | |
| 208 | 208 | added: v10.5.0 | |
| 209 | 209 | --> | |
@@ -224,7 +224,7 @@ if (isMainThread) { | |||
| 224 | 224 | } | |
| 225 | 225 | ``` | |
| 226 | 226 | ||
| 227 | - ## Class: MessageChannel | ||
| 227 | + ## Class: `MessageChannel` | ||
| 228 | 228 | <!-- YAML | |
| 229 | 229 | added: v10.5.0 | |
| 230 | 230 | --> | |
@@ -244,7 +244,7 @@ port2.postMessage({ foo: 'bar' }); | |||
| 244 | 244 | // Prints: received { foo: 'bar' } from the `port1.on('message')` listener | |
| 245 | 245 | ``` | |
| 246 | 246 | ||
| 247 | - ## Class: MessagePort | ||
| 247 | + ## Class: `MessagePort` | ||
| 248 | 248 | <!-- YAML | |
| 249 | 249 | added: v10.5.0 | |
| 250 | 250 | --> | |
@@ -259,7 +259,7 @@ structured data, memory regions and other `MessagePort`s between different | |||
| 259 | 259 | With the exception of `MessagePort`s being [`EventEmitter`][]s rather | |
| 260 | 260 | than [`EventTarget`][]s, this implementation matches [browser `MessagePort`][]s. | |
| 261 | 261 | ||
| 262 | - ### Event: 'close' | ||
| 262 | + ### Event: `'close'` | ||
| 263 | 263 | <!-- YAML | |
| 264 | 264 | added: v10.5.0 | |
| 265 | 265 | --> | |
@@ -281,7 +281,7 @@ port1.postMessage('foobar'); | |||
| 281 | 281 | port1.close(); | |
| 282 | 282 | ``` | |
| 283 | 283 | ||
| 284 | - ### Event: 'message' | ||
| 284 | + ### Event: `'message'` | ||
| 285 | 285 | <!-- YAML | |
| 286 | 286 | added: v10.5.0 | |
| 287 | 287 | --> | |
@@ -294,7 +294,7 @@ input of [`port.postMessage()`][]. | |||
| 294 | 294 | Listeners on this event will receive a clone of the `value` parameter as passed | |
| 295 | 295 | to `postMessage()` and no further arguments. | |
| 296 | 296 | ||
| 297 | - ### port.close() | ||
| 297 | + ### `port.close()` | ||
| 298 | 298 | <!-- YAML | |
| 299 | 299 | added: v10.5.0 | |
| 300 | 300 | --> | |
@@ -306,7 +306,7 @@ This method can be called when no further communication will happen over this | |||
| 306 | 306 | The [`'close'` event][] will be emitted on both `MessagePort` instances that | |
| 307 | 307 | are part of the channel. | |
| 308 | 308 | ||
| 309 | - ### port.postMessage(value\[, transferList\]) | ||
| 309 | + ### `port.postMessage(value[, transferList])` | ||
| 310 | 310 | <!-- YAML | |
| 311 | 311 | added: v10.5.0 | |
| 312 | 312 | --> | |
@@ -387,7 +387,7 @@ posting without having side effects. | |||
| 387 | 387 | For more information on the serialization and deserialization mechanisms | |
| 388 | 388 | behind this API, see the [serialization API of the `v8` module][v8.serdes]. | |
| 389 | 389 | ||
| 390 | - ### port.ref() | ||
| 390 | + ### `port.ref()` | ||
| 391 | 391 | <!-- YAML | |
| 392 | 392 | added: v10.5.0 | |
| 393 | 393 | --> | |
@@ -400,7 +400,7 @@ If listeners are attached or removed using `.on('message')`, the port will | |||
| 400 | 400 | be `ref()`ed and `unref()`ed automatically depending on whether | |
| 401 | 401 | listeners for the event exist. | |
| 402 | 402 | ||
| 403 | - ### port.start() | ||
| 403 | + ### `port.start()` | ||
| 404 | 404 | <!-- YAML | |
| 405 | 405 | added: v10.5.0 | |
| 406 | 406 | --> | |
@@ -415,7 +415,7 @@ Node.js also diverges in its handling of `.onmessage`. Setting it will | |||
| 415 | 415 | automatically call `.start()`, but unsetting it will let messages queue up | |
| 416 | 416 | until a new handler is set or the port is discarded. | |
| 417 | 417 | ||
| 418 | - ### port.unref() | ||
| 418 | + ### `port.unref()` | ||
| 419 | 419 | <!-- YAML | |
| 420 | 420 | added: v10.5.0 | |
| 421 | 421 | --> | |
@@ -428,7 +428,7 @@ If listeners are attached or removed using `.on('message')`, the port will | |||
| 428 | 428 | be `ref()`ed and `unref()`ed automatically depending on whether | |
| 429 | 429 | listeners for the event exist. | |
| 430 | 430 | ||
| 431 | - ## Class: Worker | ||
| 431 | + ## Class: `Worker` | ||
| 432 | 432 | <!-- YAML | |
| 433 | 433 | added: v10.5.0 | |
| 434 | 434 | --> | |
@@ -503,7 +503,7 @@ if (isMainThread) { | |||
| 503 | 503 | } | |
| 504 | 504 | ``` | |
| 505 | 505 | ||
| 506 | - ### new Worker(filename\[, options\]) | ||
| 506 | + ### `new Worker(filename[, options])` | ||
| 507 | 507 | <!-- YAML | |
| 508 | 508 | added: v10.5.0 | |
| 509 | 509 | changes: | |
@@ -560,7 +560,7 @@ changes: | |||
| 560 | 560 | * `codeRangeSizeMb` {number} The size of a pre-allocated memory range | |
| 561 | 561 | used for generated code. | |
| 562 | 562 | ||
| 563 | - ### Event: 'error' | ||
| 563 | + ### Event: `'error'` | ||
| 564 | 564 | <!-- YAML | |
| 565 | 565 | added: v10.5.0 | |
| 566 | 566 | --> | |
@@ -570,7 +570,7 @@ added: v10.5.0 | |||
| 570 | 570 | The `'error'` event is emitted if the worker thread throws an uncaught | |
| 571 | 571 | exception. In that case, the worker will be terminated. | |
| 572 | 572 | ||
| 573 | - ### Event: 'exit' | ||
| 573 | + ### Event: `'exit'` | ||
| 574 | 574 | <!-- YAML | |
| 575 | 575 | added: v10.5.0 | |
| 576 | 576 | --> | |
@@ -582,7 +582,7 @@ exited by calling [`process.exit()`][], the `exitCode` parameter will be the | |||
| 582 | 582 | passed exit code. If the worker was terminated, the `exitCode` parameter will | |
| 583 | 583 | be `1`. | |
| 584 | 584 | ||
| 585 | - ### Event: 'message' | ||
| 585 | + ### Event: `'message'` | ||
| 586 | 586 | <!-- YAML | |
| 587 | 587 | added: v10.5.0 | |
| 588 | 588 | --> | |
@@ -593,15 +593,15 @@ The `'message'` event is emitted when the worker thread has invoked | |||
| 593 | 593 | [`require('worker_threads').parentPort.postMessage()`][]. | |
| 594 | 594 | See the [`port.on('message')`][] event for more details. | |
| 595 | 595 | ||
| 596 | - ### Event: 'online' | ||
| 596 | + ### Event: `'online'` | ||
| 597 | 597 | <!-- YAML | |
| 598 | 598 | added: v10.5.0 | |
| 599 | 599 | --> | |
| 600 | 600 | ||
| 601 | 601 | The `'online'` event is emitted when the worker thread has started executing | |
| 602 | 602 | JavaScript code. | |
| 603 | 603 | ||
| 604 | - ### worker.postMessage(value\[, transferList\]) | ||
| 604 | + ### `worker.postMessage(value[, transferList])` | ||
| 605 | 605 | <!-- YAML | |
| 606 | 606 | added: v10.5.0 | |
| 607 | 607 | --> | |
@@ -613,7 +613,7 @@ Send a message to the worker that will be received via | |||
| 613 | 613 | [`require('worker_threads').parentPort.on('message')`][]. | |
| 614 | 614 | See [`port.postMessage()`][] for more details. | |
| 615 | 615 | ||
| 616 | - ### worker.ref() | ||
| 616 | + ### `worker.ref()` | ||
| 617 | 617 | <!-- YAML | |
| 618 | 618 | added: v10.5.0 | |
| 619 | 619 | --> | |
@@ -623,7 +623,7 @@ Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker will | |||
| 623 | 623 | behavior). If the worker is `ref()`ed, calling `ref()` again will have | |
| 624 | 624 | no effect. | |
| 625 | 625 | ||
| 626 | - ### worker.resourceLimits | ||
| 626 | + ### `worker.resourceLimits` | ||
| 627 | 627 | <!-- YAML | |
| 628 | 628 | added: v13.2.0 | |
| 629 | 629 | --> | |
@@ -639,7 +639,7 @@ this matches its values. | |||
| 639 | 639 | ||
| 640 | 640 | If the worker has stopped, the return value is an empty object. | |
| 641 | 641 | ||
| 642 | - ### worker.stderr | ||
| 642 | + ### `worker.stderr` | ||
| 643 | 643 | <!-- YAML | |
| 644 | 644 | added: v10.5.0 | |
| 645 | 645 | --> | |
@@ -651,7 +651,7 @@ inside the worker thread. If `stderr: true` was not passed to the | |||
| 651 | 651 | [`Worker`][] constructor, then data will be piped to the parent thread's | |
| 652 | 652 | [`process.stderr`][] stream. | |
| 653 | 653 | ||
| 654 | - ### worker.stdin | ||
| 654 | + ### `worker.stdin` | ||
| 655 | 655 | <!-- YAML | |
| 656 | 656 | added: v10.5.0 | |
| 657 | 657 | --> | |
@@ -662,7 +662,7 @@ If `stdin: true` was passed to the [`Worker`][] constructor, this is a | |||
| 662 | 662 | writable stream. The data written to this stream will be made available in | |
| 663 | 663 | the worker thread as [`process.stdin`][]. | |
| 664 | 664 | ||
| 665 | - ### worker.stdout | ||
| 665 | + ### `worker.stdout` | ||
| 666 | 666 | <!-- YAML | |
| 667 | 667 | added: v10.5.0 | |
| 668 | 668 | --> | |
@@ -674,7 +674,7 @@ inside the worker thread. If `stdout: true` was not passed to the | |||
| 674 | 674 | [`Worker`][] constructor, then data will be piped to the parent thread's | |
| 675 | 675 | [`process.stdout`][] stream. | |
| 676 | 676 | ||
| 677 | - ### worker.terminate() | ||
| 677 | + ### `worker.terminate()` | ||
| 678 | 678 | <!-- YAML | |
| 679 | 679 | added: v10.5.0 | |
| 680 | 680 | changes: | |
@@ -692,7 +692,7 @@ Stop all JavaScript execution in the worker thread as soon as possible. | |||
| 692 | 692 | Returns a Promise for the exit code that is fulfilled when the | |
| 693 | 693 | [`'exit'` event][] is emitted. | |
| 694 | 694 | ||
| 695 | - ### worker.threadId | ||
| 695 | + ### `worker.threadId` | ||
| 696 | 696 | <!-- YAML | |
| 697 | 697 | added: v10.5.0 | |
| 698 | 698 | --> | |
@@ -703,7 +703,7 @@ An integer identifier for the referenced thread. Inside the worker thread, | |||
| 703 | 703 | it is available as [`require('worker_threads').threadId`][]. | |
| 704 | 704 | This value is unique for each `Worker` instance inside a single process. | |
| 705 | 705 | ||
| 706 | - ### worker.unref() | ||
| 706 | + ### `worker.unref()` | ||
| 707 | 707 | <!-- YAML | |
| 708 | 708 | added: v10.5.0 | |
| 709 | 709 | --> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments