diff options
author | Jenia <jeniabrook@gmail.com> | 2019-08-19 01:13:26 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-09-25 19:21:04 +0300 |
commit | 9150c4dc72952b84d5410874ec9cc8c8a4b3db28 (patch) | |
tree | a277f0e20d9a1bcc555d9d86ed036cdcd1d24136 /doc/api | |
parent | 6f8ef2cbab647dd9a7d2e0080299a927f0afba7b (diff) |
events: add support for EventTarget in once
PR-URL: https://github.com/nodejs/node/pull/29498
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'doc/api')
-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 3b92a04ca58..8d409582329 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 |