@@ -142,7 +142,7 @@ inherit from its global `Object` class. Objects passed to the
142142and inherit from its global ` Object ` class.
143143
144144However, the created ` MessagePort ` will no longer inherit from
145- [ ` EventEmitter ` ] [ ] , and only [ ` port.onmessage() ` ] [ ] can be used to receive
145+ [ ` EventTarget ` ] [ ] , and only [ ` port.onmessage() ` ] [ ] can be used to receive
146146events using it.
147147
148148## ` worker.parentPort `
@@ -297,17 +297,22 @@ port2.postMessage({ foo: 'bar' });
297297## Class: ` MessagePort `
298298<!-- YAML
299299added: v10.5.0
300+ changes:
301+ - version:
302+ - v14.7.0
303+ pr-url: https://github.com/nodejs/node/pull/34057
304+ description: This class now inherits from `EventTarget` rather than
305+ from `EventEmitter`.
300306-->
301307
302- * Extends: {EventEmitter }
308+ * Extends: {EventTarget }
303309
304310Instances of the ` worker.MessagePort ` class represent one end of an
305311asynchronous, two-way communications channel. It can be used to transfer
306312structured data, memory regions and other ` MessagePort ` s between different
307313[ ` Worker ` ] [ ] s.
308314
309- With the exception of ` MessagePort ` s being [ ` EventEmitter ` ] [ ] s rather
310- than [ ` EventTarget ` ] [ ] s, this implementation matches [ browser ` MessagePort ` ] [ ] s.
315+ This implementation matches [ browser ` MessagePort ` ] [ ] s.
311316
312317### Event: ` 'close' `
313318<!-- YAML
@@ -986,7 +991,6 @@ active handle in the event system. If the worker is already `unref()`ed calling
986991[ `Buffer` ] : buffer.md
987992[ `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` ] : errors.md#errors_err_missing_message_port_in_transfer_list
988993[ `ERR_WORKER_NOT_RUNNING` ] : errors.md#ERR_WORKER_NOT_RUNNING
989- [ `EventEmitter` ] : events.md
990994[ `EventTarget` ] : https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
991995[ `FileHandle` ] : fs.md#fs_class_filehandle
992996[ `KeyObject` ] : crypto.md#crypto_class_keyobject
0 commit comments