From 49ed583244e87b9c50a1d522d4cf5d2bd1a009f4 Mon Sep 17 00:00:00 2001 From: Renegade334 Date: Mon, 15 Sep 2025 01:10:52 +0100 Subject: [PATCH] doc: disambiguate top-level `worker_threads` module exports --- doc/api/errors.md | 2 +- doc/api/globals.md | 4 +-- doc/api/process.md | 2 +- doc/api/worker_threads.md | 56 +++++++++++++++++++-------------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 88cd36793e33e2..7d0439a7dab826 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -4413,7 +4413,7 @@ An error occurred trying to allocate memory. This should never happen. [`new URLSearchParams(iterable)`]: url.md#new-urlsearchparamsiterable [`package.json`]: packages.md#nodejs-packagejson-field-definitions [`postMessage()`]: worker_threads.md#portpostmessagevalue-transferlist -[`postMessageToThread()`]: worker_threads.md#workerpostmessagetothreadthreadid-value-transferlist-timeout +[`postMessageToThread()`]: worker_threads.md#worker_threadspostmessagetothreadthreadid-value-transferlist-timeout [`process.on('exit')`]: process.md#event-exit [`process.send()`]: process.md#processsendmessage-sendhandle-options-callback [`process.setUncaughtExceptionCaptureCallback()`]: process.md#processsetuncaughtexceptioncapturecallbackfn diff --git a/doc/api/globals.md b/doc/api/globals.md index 05eb1815ecf5eb..bcb6d4e355a43e 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -829,7 +829,7 @@ navigator.locks.request('shared_resource', { mode: 'shared' }, async (lock) => { }); ``` -See [`worker.locks`][] for detailed API documentation. +See [`worker_threads.locks`][] for detailed API documentation. ## Class: `PerformanceEntry` @@ -1377,7 +1377,7 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][]. [`setTimeout`]: timers.md#settimeoutcallback-delay-args [`structuredClone`]: https://developer.mozilla.org/en-US/docs/Web/API/structuredClone [`window.navigator`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/navigator -[`worker.locks`]: worker_threads.md#workerlocks +[`worker_threads.locks`]: worker_threads.md#worker_threadslocks [browser `LockManager`]: https://developer.mozilla.org/en-US/docs/Web/API/LockManager [buffer section]: buffer.md [built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects diff --git a/doc/api/process.md b/doc/api/process.md index e30639f6a006f3..043d368ba58c19 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -4534,7 +4534,7 @@ cases: [`net.Server`]: net.md#class-netserver [`net.Socket`]: net.md#class-netsocket [`os.constants.dlopen`]: os.md#dlopen-constants -[`postMessageToThread()`]: worker_threads.md#workerpostmessagetothreadthreadid-value-transferlist-timeout +[`postMessageToThread()`]: worker_threads.md#worker_threadspostmessagetothreadthreadid-value-transferlist-timeout [`process.argv`]: #processargv [`process.config`]: #processconfig [`process.execPath`]: #processexecpath diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 94dbddacac40da..5d0b2d5c5efafd 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -10,13 +10,13 @@ The `node:worker_threads` module enables the use of threads that execute JavaScript in parallel. To access it: ```mjs -import worker from 'node:worker_threads'; +import worker_threads from 'node:worker_threads'; ``` ```cjs 'use strict'; -const worker = require('node:worker_threads'); +const worker_threads = require('node:worker_threads'); ``` 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 [`Worker constructor options`][] to know how to customize worker thread options, specifically `argv` and `execArgv` options. -## `worker.getEnvironmentData(key)` +## `worker_threads.getEnvironmentData(key)`