From 678fa779b818dfe39ce11eabf1ff06fef2f0fd57 Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich <18708370+Flarna@users.noreply.github.com> Date: Tue, 3 Mar 2020 08:52:27 +0100 Subject: [PATCH 1/2] doc: change worker.takeHeapSnapshot to getHeapSnapshot Adapt doc to match implementation which exports getHeapSnapshot(). --- doc/api/worker_threads.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index e773949b49df52..0a210533ce3c4d 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -685,7 +685,7 @@ inside the worker thread. If `stdout: true` was not passed to the [`Worker`][] constructor, then data will be piped to the parent thread's [`process.stdout`][] stream. -### `worker.takeHeapSnapshot()` +### `worker.getHeapSnapshot()` From 4a9b8ccba5ae48c376f9f8ff65c0cdf5e2c2d90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= <18708370+Flarna@users.noreply.github.com> Date: Tue, 3 Mar 2020 21:06:06 +0100 Subject: [PATCH 2/2] ensure alphabetical order --- doc/api/worker_threads.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 0a210533ce3c4d..406728995c9a94 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -612,6 +612,21 @@ added: v10.5.0 The `'online'` event is emitted when the worker thread has started executing JavaScript code. +### `worker.getHeapSnapshot()` + + +* Returns: {Promise} A promise for a Readable Stream containing + a V8 heap snapshot + +Returns a readable stream for a V8 snapshot of the current state of the Worker. +See [`v8.getHeapSnapshot()`][] for more details. + +If the Worker thread is no longer running, which may occur before the +[`'exit'` event][] is emitted, the returned `Promise` will be rejected +immediately with an [`ERR_WORKER_NOT_RUNNING`][] error. + ### `worker.postMessage(value[, transferList])` - -* Returns: {Promise} A promise for a Readable Stream containing - a V8 heap snapshot - -Returns a readable stream for a V8 snapshot of the current state of the Worker. -See [`v8.getHeapSnapshot()`][] for more details. - -If the Worker thread is no longer running, which may occur before the -[`'exit'` event][] is emitted, the returned `Promise` will be rejected -immediately with an [`ERR_WORKER_NOT_RUNNING`][] error. - ### `worker.terminate()`