summaryrefslogtreecommitdiff
path: root/doc/api/worker_threads.md
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2018-07-07 23:32:23 -0500
committerGus Caplan <me@gus.host>2018-07-12 16:11:11 -0500
commit8cae9b2ff808198b4451d9de634320fa5750c4cd (patch)
tree40b8264e77fefec5a9dba3c0d646483b8260cf3a /doc/api/worker_threads.md
parent1849a2b2e98c093e27d781bd5040f76a22e8f977 (diff)
downloadandroid-node-v8-8cae9b2ff808198b4451d9de634320fa5750c4cd.tar.gz
android-node-v8-8cae9b2ff808198b4451d9de634320fa5750c4cd.tar.bz2
android-node-v8-8cae9b2ff808198b4451d9de634320fa5750c4cd.zip
tools: add no-duplicate-requires rule
PR-URL: https://github.com/nodejs/node/pull/21712 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
Diffstat (limited to 'doc/api/worker_threads.md')
-rw-r--r--doc/api/worker_threads.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md
index d20fd0fce5..8b301f42a8 100644
--- a/doc/api/worker_threads.md
+++ b/doc/api/worker_threads.md
@@ -286,7 +286,7 @@ For example:
```js
const assert = require('assert');
const {
- Worker, MessageChannel, MessagePort, isMainThread
+ Worker, MessageChannel, MessagePort, isMainThread, parentPort
} = require('worker_threads');
if (isMainThread) {
const worker = new Worker(__filename);
@@ -296,7 +296,7 @@ if (isMainThread) {
console.log('received:', value);
});
} else {
- require('worker_threads').once('message', (value) => {
+ parentPort.once('message', (value) => {
assert(value.hereIsYourPort instanceof MessagePort);
value.hereIsYourPort.postMessage('the worker is sending this');
value.hereIsYourPort.close();