@@ -140,7 +140,7 @@ inherit from its global `Object` class. Objects passed to the
140140and inherit from its global ` Object ` class.
141141
142142However, the created ` MessagePort ` will no longer inherit from
143- [ ` EventEmitter ` ] [ ] , and only [ ` port.onmessage() ` ] [ ] can be used to receive
143+ [ ` EventTarget ` ] [ ] , and only [ ` port.onmessage() ` ] [ ] can be used to receive
144144events using it.
145145
146146## ` worker.parentPort `
@@ -295,17 +295,22 @@ port2.postMessage({ foo: 'bar' });
295295## Class: ` MessagePort `
296296<!-- YAML
297297added: v10.5.0
298+ changes:
299+ - version:
300+ - v14.7.0
301+ pr-url: https://github.com/nodejs/node/pull/34057
302+ description: This class now inherits from `EventTarget` rather than
303+ from `EventEmitter`.
298304-->
299305
300- * Extends: {EventEmitter }
306+ * Extends: {EventTarget }
301307
302308Instances of the ` worker.MessagePort ` class represent one end of an
303309asynchronous, two-way communications channel. It can be used to transfer
304310structured data, memory regions and other ` MessagePort ` s between different
305311[ ` Worker ` ] [ ] s.
306312
307- With the exception of ` MessagePort ` s being [ ` EventEmitter ` ] [ ] s rather
308- than [ ` EventTarget ` ] [ ] s, this implementation matches [ browser ` MessagePort ` ] [ ] s.
313+ This implementation matches [ browser ` MessagePort ` ] [ ] s.
309314
310315### Event: ` 'close' `
311316<!-- YAML
@@ -909,7 +914,6 @@ active handle in the event system. If the worker is already `unref()`ed calling
909914[ `Buffer` ] : buffer.md
910915[ `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` ] : errors.md#errors_err_missing_message_port_in_transfer_list
911916[ `ERR_WORKER_NOT_RUNNING` ] : errors.md#ERR_WORKER_NOT_RUNNING
912- [ `EventEmitter` ] : events.md
913917[ `EventTarget` ] : https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
914918[ `FileHandle` ] : fs.md#fs_class_filehandle
915919[ `KeyObject` ] : crypto.md#crypto_class_keyobject
0 commit comments