diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/events.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/api/events.md b/doc/api/events.md index 3b92a04ca5..8d40958232 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -703,11 +703,15 @@ added: v11.13.0 * `name` {string} * Returns: {Promise} -Creates a `Promise` that is resolved when the `EventEmitter` emits the given +Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given event or that is rejected when the `EventEmitter` emits `'error'`. The `Promise` will resolve with an array of all the arguments emitted to the given event. +This method is intentionally generic and works with the web platform +[EventTarget](WHATWG-EventTarget) interface, which has no special +`'error'` event semantics and does not listen to the `'error'` event. + ```js const { once, EventEmitter } = require('events'); @@ -735,7 +739,7 @@ async function run() { run(); ``` - +[WHATWG-EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) [`--trace-warnings`]: cli.html#cli_trace_warnings [`EventEmitter.defaultMaxListeners`]: #events_eventemitter_defaultmaxlisteners [`domain`]: domain.html |