From b62090d9d4d970ceef4c7b8313d58a4ec3182387 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 28 Oct 2020 00:14:34 +0100 Subject: [PATCH] doc: update MessagePort documentation for EventTarget inheritance Refs: https://github.com/nodejs/node/pull/34057 Refs: https://github.com/nodejs/node/issues/35835 PR-URL: https://github.com/nodejs/node/pull/35839 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca --- doc/api/worker_threads.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 1bf76762fb269a..7d070dc58fe171 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -140,7 +140,7 @@ inherit from its global `Object` class. Objects passed to the and inherit from its global `Object` class. However, the created `MessagePort` will no longer inherit from -[`EventEmitter`][], and only [`port.onmessage()`][] can be used to receive +[`EventTarget`][], and only [`port.onmessage()`][] can be used to receive events using it. ## `worker.parentPort` @@ -295,17 +295,22 @@ port2.postMessage({ foo: 'bar' }); ## Class: `MessagePort` -* Extends: {EventEmitter} +* Extends: {EventTarget} Instances of the `worker.MessagePort` class represent one end of an asynchronous, two-way communications channel. It can be used to transfer structured data, memory regions and other `MessagePort`s between different [`Worker`][]s. -With the exception of `MessagePort`s being [`EventEmitter`][]s rather -than [`EventTarget`][]s, this implementation matches [browser `MessagePort`][]s. +This implementation matches [browser `MessagePort`][]s. ### Event: `'close'`