Skip to content

Commit

Permalink
doc: make MDN links to global classes more consistent
Browse files Browse the repository at this point in the history
PR-URL: #56923
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
  • Loading branch information
aduh95 authored and targos committed Feb 10, 2025
1 parent d901987 commit 00da003
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions doc/api/worker_threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ inherits from its global `Object` class. Objects passed to the
and inherit from its global `Object` class.

However, the created `MessagePort` no longer inherits from
[`EventTarget`][], and only [`port.onmessage()`][] can be used to receive
{EventTarget}, and only [`port.onmessage()`][] can be used to receive
events using it.

## `worker.parentPort`
Expand Down Expand Up @@ -847,14 +847,14 @@ circularData.foo = circularData;
port2.postMessage(circularData);
```
`transferList` may be a list of [`ArrayBuffer`][], [`MessagePort`][], and
`transferList` may be a list of {ArrayBuffer}, [`MessagePort`][], and
[`FileHandle`][] objects.
After transferring, they are not usable on the sending side of the channel
anymore (even if they are not contained in `value`). Unlike with
[child processes][], transferring handles such as network sockets is currently
not supported.
If `value` contains [`SharedArrayBuffer`][] instances, those are accessible
If `value` contains {SharedArrayBuffer} instances, those are accessible
from either thread. They cannot be listed in `transferList`.
`value` may still contain `ArrayBuffer` instances that are not in
Expand Down Expand Up @@ -892,8 +892,8 @@ behind this API, see the [serialization API of the `node:v8` module][v8.serdes].
#### Considerations when transferring TypedArrays and Buffers
All `TypedArray` and `Buffer` instances are views over an underlying
`ArrayBuffer`. That is, it is the `ArrayBuffer` that actually stores
All {TypedArray|Buffer} instances are views over an underlying
{ArrayBuffer}. That is, it is the `ArrayBuffer` that actually stores
the raw data while the `TypedArray` and `Buffer` objects provide a
way of viewing and manipulating the data. It is possible and common
for multiple views to be created over the same `ArrayBuffer` instance.
Expand Down Expand Up @@ -942,8 +942,8 @@ those `ArrayBuffer`s unusable.
Because object cloning uses the [HTML structured clone algorithm][],
non-enumerable properties, property accessors, and object prototypes are
not preserved. In particular, [`Buffer`][] objects will be read as
plain [`Uint8Array`][]s on the receiving side, and instances of JavaScript
not preserved. In particular, {Buffer} objects will be read as
plain {Uint8Array}s on the receiving side, and instances of JavaScript
classes will be cloned as plain JavaScript objects.
<!-- eslint-disable no-unused-private-class-members -->
Expand Down Expand Up @@ -1583,21 +1583,16 @@ thread spawned will spawn another until the application crashes.
[`'online'` event]: #event-online
[`--max-old-space-size`]: cli.md#--max-old-space-sizesize-in-mib
[`--max-semi-space-size`]: cli.md#--max-semi-space-sizesize-in-mib
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
[`AsyncResource`]: async_hooks.md#class-asyncresource
[`Buffer.allocUnsafe()`]: buffer.md#static-method-bufferallocunsafesize
[`Buffer`]: buffer.md
[`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`]: errors.md#err_missing_message_port_in_transfer_list
[`ERR_WORKER_MESSAGING_ERRORED`]: errors.md#err_worker_messaging_errored
[`ERR_WORKER_MESSAGING_FAILED`]: errors.md#err_worker_messaging_failed
[`ERR_WORKER_MESSAGING_SAME_THREAD`]: errors.md#err_worker_messaging_same_thread
[`ERR_WORKER_MESSAGING_TIMEOUT`]: errors.md#err_worker_messaging_timeout
[`ERR_WORKER_NOT_RUNNING`]: errors.md#err_worker_not_running
[`EventTarget`]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
[`FileHandle`]: fs.md#class-filehandle
[`MessagePort`]: #class-messageport
[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
[`WebAssembly.Module`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module
[`Worker constructor options`]: #new-workerfilename-options
[`Worker`]: #class-worker
Expand Down

0 comments on commit 00da003

Please sign in to comment.