Skip to content

Commit 28fae8b

Browse files
Flarnammarchini
authored andcommitted
doc: change worker.takeHeapSnapshot to getHeapSnapshot
Adapt doc to match implementation which exports getHeapSnapshot(). PR-URL: #32061 Refs: #31569 Refs: https://github.com/nodejs/node/blob/987a67339518d0380177a2e589f2bbd274230d0e/lib/internal/worker.js#L323 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Shelley Vohr <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 173d044 commit 28fae8b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

doc/api/worker_threads.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,21 @@ added: v10.5.0
612612
The `'online'` event is emitted when the worker thread has started executing
613613
JavaScript code.
614614

615+
### `worker.getHeapSnapshot()`
616+
<!-- YAML
617+
added: v13.9.0
618+
-->
619+
620+
* Returns: {Promise} A promise for a Readable Stream containing
621+
a V8 heap snapshot
622+
623+
Returns a readable stream for a V8 snapshot of the current state of the Worker.
624+
See [`v8.getHeapSnapshot()`][] for more details.
625+
626+
If the Worker thread is no longer running, which may occur before the
627+
[`'exit'` event][] is emitted, the returned `Promise` will be rejected
628+
immediately with an [`ERR_WORKER_NOT_RUNNING`][] error.
629+
615630
### `worker.postMessage(value[, transferList])`
616631
<!-- YAML
617632
added: v10.5.0
@@ -685,21 +700,6 @@ inside the worker thread. If `stdout: true` was not passed to the
685700
[`Worker`][] constructor, then data will be piped to the parent thread's
686701
[`process.stdout`][] stream.
687702

688-
### `worker.takeHeapSnapshot()`
689-
<!-- YAML
690-
added: v13.9.0
691-
-->
692-
693-
* Returns: {Promise} A promise for a Readable Stream containing
694-
a V8 heap snapshot
695-
696-
Returns a readable stream for a V8 snapshot of the current state of the Worker.
697-
See [`v8.getHeapSnapshot()`][] for more details.
698-
699-
If the Worker thread is no longer running, which may occur before the
700-
[`'exit'` event][] is emitted, the returned `Promise` will be rejected
701-
immediately with an [`ERR_WORKER_NOT_RUNNING`][] error.
702-
703703
### `worker.terminate()`
704704
<!-- YAML
705705
added: v10.5.0

0 commit comments

Comments
 (0)