summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJenia <jeniabrook@gmail.com>2019-08-19 01:13:26 +0300
committerRich Trott <rtrott@gmail.com>2019-09-22 17:48:21 -0700
commit34a61d563088c97f13e193d00c91cd893f1479b8 (patch)
tree36e093e6ad0947e053e86d4cc7ee3b32b42a2ad2 /doc
parent54c4139efd6a2063c5c20d5483935cd2ad4946fd (diff)
downloadandroid-node-v8-34a61d563088c97f13e193d00c91cd893f1479b8.tar.gz
android-node-v8-34a61d563088c97f13e193d00c91cd893f1479b8.tar.bz2
android-node-v8-34a61d563088c97f13e193d00c91cd893f1479b8.zip
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')
-rw-r--r--doc/api/events.md8
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