From 5c0a9035d374fd47254f259373d0b37ae9db43a0 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 --- 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 4b04930db2fc6c..086e541013e31f 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -142,7 +142,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` @@ -297,17 +297,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'`