From bc1e3575d4f02af889abc76aaf869e822e5334df 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] doc: change worker.takeHeapSnapshot to getHeapSnapshot Adapt doc to match implementation which exports getHeapSnapshot(). PR-URL: https://github.com/nodejs/node/pull/32061 Refs: https://github.com/nodejs/node/pull/31569 Refs: https://github.com/nodejs/node/blob/987a67339518d0380177a2e589f2bbd274230d0e/lib/internal/worker.js#L323 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Shelley Vohr Reviewed-By: Matheus Marchini Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Ruben Bridgewater --- 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 e773949b49df52..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()`