Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 923082a

Browse filesBrowse files
Renegade334aduh95
authored andcommitted
doc: disambiguate top-level worker_threads module exports
PR-URL: #59890 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 4f7745a commit 923082a
Copy full SHA for 923082a

File tree

Expand file treeCollapse file tree

4 files changed

+32
-32
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+32
-32
lines changed
Open diff view settings
Collapse file

‎doc/api/errors.md‎

Copy file name to clipboardExpand all lines: doc/api/errors.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -4411,7 +4411,7 @@ An error occurred trying to allocate memory. This should never happen.
44114411
[`new URLSearchParams(iterable)`]: url.md#new-urlsearchparamsiterable
44124412
[`package.json`]: packages.md#nodejs-packagejson-field-definitions
44134413
[`postMessage()`]: worker_threads.md#portpostmessagevalue-transferlist
4414-
[`postMessageToThread()`]: worker_threads.md#workerpostmessagetothreadthreadid-value-transferlist-timeout
4414+
[`postMessageToThread()`]: worker_threads.md#worker_threadspostmessagetothreadthreadid-value-transferlist-timeout
44154415
[`process.on('exit')`]: process.md#event-exit
44164416
[`process.send()`]: process.md#processsendmessage-sendhandle-options-callback
44174417
[`process.setUncaughtExceptionCaptureCallback()`]: process.md#processsetuncaughtexceptioncapturecallbackfn
Collapse file

‎doc/api/globals.md‎

Copy file name to clipboardExpand all lines: doc/api/globals.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ navigator.locks.request('shared_resource', { mode: 'shared' }, async (lock) => {
821821
});
822822
```
823823

824-
See [`worker.locks`][] for detailed API documentation.
824+
See [`worker_threads.locks`][] for detailed API documentation.
825825

826826
## Class: `PerformanceEntry`
827827

@@ -1369,7 +1369,7 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
13691369
[`setTimeout`]: timers.md#settimeoutcallback-delay-args
13701370
[`structuredClone`]: https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
13711371
[`window.navigator`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/navigator
1372-
[`worker.locks`]: worker_threads.md#workerlocks
1372+
[`worker_threads.locks`]: worker_threads.md#worker_threadslocks
13731373
[browser `LockManager`]: https://developer.mozilla.org/en-US/docs/Web/API/LockManager
13741374
[buffer section]: buffer.md
13751375
[built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
Collapse file

‎doc/api/process.md‎

Copy file name to clipboardExpand all lines: doc/api/process.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -4618,7 +4618,7 @@ cases:
46184618
[`net.Server`]: net.md#class-netserver
46194619
[`net.Socket`]: net.md#class-netsocket
46204620
[`os.constants.dlopen`]: os.md#dlopen-constants
4621-
[`postMessageToThread()`]: worker_threads.md#workerpostmessagetothreadthreadid-value-transferlist-timeout
4621+
[`postMessageToThread()`]: worker_threads.md#worker_threadspostmessagetothreadthreadid-value-transferlist-timeout
46224622
[`process.argv`]: #processargv
46234623
[`process.config`]: #processconfig
46244624
[`process.execPath`]: #processexecpath
Collapse file

‎doc/api/worker_threads.md‎

Copy file name to clipboardExpand all lines: doc/api/worker_threads.md
+28-28Lines changed: 28 additions & 28 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ The `node:worker_threads` module enables the use of threads that execute
1010
JavaScript in parallel. To access it:
1111

1212
```mjs
13-
import worker from 'node:worker_threads';
13+
import worker_threads from 'node:worker_threads';
1414
```
1515

1616
```cjs
1717
'use strict';
1818

19-
const worker = require('node:worker_threads');
19+
const worker_threads = require('node:worker_threads');
2020
```
2121

2222
Workers (threads) are useful for performing CPU-intensive JavaScript operations.
@@ -101,7 +101,7 @@ Worker threads inherit non-process-specific options by default. Refer to
101101
[`Worker constructor options`][] to know how to customize worker thread options,
102102
specifically `argv` and `execArgv` options.
103103

104-
## `worker.getEnvironmentData(key)`
104+
## `worker_threads.getEnvironmentData(key)`
105105

106106
<!-- YAML
107107
added:
@@ -158,7 +158,7 @@ if (isMainThread) {
158158
}
159159
```
160160
161-
## `worker.isInternalThread`
161+
## `worker_threads.isInternalThread`
162162
163163
<!-- YAML
164164
added:
@@ -202,7 +202,7 @@ const { isInternalThread } = require('node:worker_threads');
202202
console.log(isInternalThread); // false
203203
```
204204
205-
## `worker.isMainThread`
205+
## `worker_threads.isMainThread`
206206
207207
<!-- YAML
208208
added: v10.5.0
@@ -238,7 +238,7 @@ if (isMainThread) {
238238
}
239239
```
240240
241-
## `worker.markAsUntransferable(object)`
241+
## `worker_threads.markAsUntransferable(object)`
242242
243243
<!-- YAML
244244
added:
@@ -315,7 +315,7 @@ console.log(typedArray2);
315315
316316
There is no equivalent to this API in browsers.
317317
318-
## `worker.isMarkedAsUntransferable(object)`
318+
## `worker_threads.isMarkedAsUntransferable(object)`
319319
320320
<!-- YAML
321321
added: v21.0.0
@@ -349,7 +349,7 @@ isMarkedAsUntransferable(pooledBuffer); // Returns true.
349349
350350
There is no equivalent to this API in browsers.
351351
352-
## `worker.markAsUncloneable(object)`
352+
## `worker_threads.markAsUncloneable(object)`
353353
354354
<!-- YAML
355355
added:
@@ -399,7 +399,7 @@ try {
399399
400400
There is no equivalent to this API in browsers.
401401
402-
## `worker.moveMessagePortToContext(port, contextifiedSandbox)`
402+
## `worker_threads.moveMessagePortToContext(port, contextifiedSandbox)`
403403
404404
<!-- YAML
405405
added: v11.13.0
@@ -425,7 +425,7 @@ However, the created `MessagePort` no longer inherits from
425425
{EventTarget}, and only [`port.onmessage()`][] can be used to receive
426426
events using it.
427427
428-
## `worker.parentPort`
428+
## `worker_threads.parentPort`
429429
430430
<!-- YAML
431431
added: v10.5.0
@@ -476,7 +476,7 @@ if (isMainThread) {
476476
}
477477
```
478478
479-
## `worker.postMessageToThread(threadId, value[, transferList][, timeout])`
479+
## `worker_threads.postMessageToThread(threadId, value[, transferList][, timeout])`
480480
481481
<!-- YAML
482482
added:
@@ -588,7 +588,7 @@ if (level === 0) {
588588
channel.onmessage = channel.close;
589589
```
590590

591-
## `worker.receiveMessageOnPort(port)`
591+
## `worker_threads.receiveMessageOnPort(port)`
592592

593593
<!-- YAML
594594
added: v12.3.0
@@ -634,7 +634,7 @@ console.log(receiveMessageOnPort(port2));
634634
When this function is used, no `'message'` event is emitted and the
635635
`onmessage` listener is not invoked.
636636
637-
## `worker.resourceLimits`
637+
## `worker_threads.resourceLimits`
638638
639639
<!-- YAML
640640
added:
@@ -654,7 +654,7 @@ this matches its values.
654654
655655
If this is used in the main thread, its value is an empty object.
656656
657-
## `worker.SHARE_ENV`
657+
## `worker_threads.SHARE_ENV`
658658
659659
<!-- YAML
660660
added: v11.14.0
@@ -685,7 +685,7 @@ new Worker('process.env.SET_IN_WORKER = "foo"', { eval: true, env: SHARE_ENV })
685685
});
686686
```
687687
688-
## `worker.setEnvironmentData(key[, value])`
688+
## `worker_threads.setEnvironmentData(key[, value])`
689689
690690
<!-- YAML
691691
added:
@@ -709,7 +709,7 @@ The `worker.setEnvironmentData()` API sets the content of
709709
`worker.getEnvironmentData()` in the current thread and all new `Worker`
710710
instances spawned from the current context.
711711
712-
## `worker.threadId`
712+
## `worker_threads.threadId`
713713
714714
<!-- YAML
715715
added: v10.5.0
@@ -721,7 +721,7 @@ An integer identifier for the current thread. On the corresponding worker object
721721
(if there is any), it is available as [`worker.threadId`][].
722722
This value is unique for each [`Worker`][] instance inside a single process.
723723
724-
## `worker.threadName`
724+
## `worker_threads.threadName`
725725
726726
<!-- YAML
727727
added: v24.6.0
@@ -732,7 +732,7 @@ added: v24.6.0
732732
A string identifier for the current thread or null if the thread is not running.
733733
On the corresponding worker object (if there is any), it is available as [`worker.threadName`][].
734734
735-
## `worker.workerData`
735+
## `worker_threads.workerData`
736736
737737
<!-- YAML
738738
added: v10.5.0
@@ -766,7 +766,7 @@ if (isMainThread) {
766766
}
767767
```
768768
769-
## `worker.locks`
769+
## `worker_threads.locks`
770770
771771
<!-- YAML
772772
added: v24.5.0
@@ -2225,7 +2225,7 @@ thread spawned will spawn another until the application crashes.
22252225
[`data:` URL]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
22262226
[`fs.close()`]: fs.md#fsclosefd-callback
22272227
[`fs.open()`]: fs.md#fsopenpath-flags-mode-callback
2228-
[`markAsUntransferable()`]: #workermarkasuntransferableobject
2228+
[`markAsUntransferable()`]: #worker_threadsmarkasuntransferableobject
22292229
[`node:cluster` module]: cluster.md
22302230
[`perf_hooks.performance`]: perf_hooks.md#perf_hooksperformance
22312231
[`perf_hooks` `eventLoopUtilization()`]: perf_hooks.md#performanceeventlooputilizationutilization1-utilization2
@@ -2242,23 +2242,23 @@ thread spawned will spawn another until the application crashes.
22422242
[`process.stdout`]: process.md#processstdout
22432243
[`process.threadCpuUsage()`]: process.md#processthreadcpuusagepreviousvalue
22442244
[`process.title`]: process.md#processtitle
2245-
[`require('node:worker_threads').isMainThread`]: #workerismainthread
2245+
[`require('node:worker_threads').isMainThread`]: #worker_threadsismainthread
22462246
[`require('node:worker_threads').parentPort.on('message')`]: #event-message
22472247
[`require('node:worker_threads').parentPort.postMessage()`]: #workerpostmessagevalue-transferlist
2248-
[`require('node:worker_threads').parentPort`]: #workerparentport
2249-
[`require('node:worker_threads').threadId`]: #workerthreadid
2250-
[`require('node:worker_threads').threadName`]: #workerthreadname
2251-
[`require('node:worker_threads').workerData`]: #workerworkerdata
2248+
[`require('node:worker_threads').parentPort`]: #worker_threadsparentport
2249+
[`require('node:worker_threads').threadId`]: #worker_threadsthreadid
2250+
[`require('node:worker_threads').threadName`]: #worker_threadsthreadname
2251+
[`require('node:worker_threads').workerData`]: #worker_threadsworkerdata
22522252
[`trace_events`]: tracing.md
22532253
[`v8.getHeapSnapshot()`]: v8.md#v8getheapsnapshotoptions
22542254
[`v8.getHeapStatistics()`]: v8.md#v8getheapstatistics
22552255
[`vm`]: vm.md
2256-
[`worker.SHARE_ENV`]: #workershare_env
2256+
[`worker.SHARE_ENV`]: #worker_threadsshare_env
22572257
[`worker.on('message')`]: #event-message_1
22582258
[`worker.postMessage()`]: #workerpostmessagevalue-transferlist
22592259
[`worker.terminate()`]: #workerterminate
2260-
[`worker.threadId`]: #workerthreadid_1
2261-
[`worker.threadName`]: #workerthreadname_1
2260+
[`worker.threadId`]: #workerthreadid
2261+
[`worker.threadName`]: #workerthreadname
22622262
[async-resource-worker-pool]: async_context.md#using-asyncresource-for-a-worker-thread-pool
22632263
[browser `LockManager`]: https://developer.mozilla.org/en-US/docs/Web/API/LockManager
22642264
[browser `MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.