| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -142,7 +142,7 @@ inherit from its global `Object` class. Objects passed to the | |||
| 142 | 142 | and inherit from its global `Object` class. | |
| 143 | 143 | ||
| 144 | 144 | However, 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 | ||
| 146 | 146 | events using it. | |
| 147 | 147 | ||
| 148 | 148 | ## `worker.parentPort` | |
@@ -297,17 +297,22 @@ port2.postMessage({ foo: 'bar' }); | |||
| 297 | 297 | ## Class: `MessagePort` | |
| 298 | 298 | <!-- YAML | |
| 299 | 299 | added: 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`. | ||
| 300 | 306 | --> | |
| 301 | 307 | ||
| 302 | - * Extends: {EventEmitter} | ||
| 308 | + * Extends: {EventTarget} | ||
| 303 | 309 | ||
| 304 | 310 | Instances of the `worker.MessagePort` class represent one end of an | |
| 305 | 311 | asynchronous, two-way communications channel. It can be used to transfer | |
| 306 | 312 | structured data, memory regions and other `MessagePort`s between different | |
| 307 | 313 | [`Worker`][]s. | |
| 308 | 314 | ||
| 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. | ||
| 311 | 316 | ||
| 312 | 317 | ### Event: `'close'` | |
| 313 | 318 | <!-- YAML | |
@@ -986,7 +991,6 @@ active handle in the event system. If the worker is already `unref()`ed calling | |||
| 986 | 991 | [`Buffer`]: buffer.md | |
| 987 | 992 | [`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`]: errors.md#errors_err_missing_message_port_in_transfer_list | |
| 988 | 993 | [`ERR_WORKER_NOT_RUNNING`]: errors.md#ERR_WORKER_NOT_RUNNING | |
| 989 | - [`EventEmitter`]: events.md | ||
| 990 | 994 | [`EventTarget`]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | |
| 991 | 995 | [`FileHandle`]: fs.md#fs_class_filehandle | |
| 992 | 996 | [`KeyObject`]: crypto.md#crypto_class_keyobject | |
| Back | FazBrowse Home | New Git URL |
0 commit comments