Skip to content

Commit 77ea039

Browse files
committed
doc: clarify addEventListener return expectations
Specifying that promises are handled may help newer Node.js developers, and stating that "The return value of a handler function is ignored" seems incorrect.
1 parent 622c372 commit 77ea039

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/api/events.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,14 +2077,15 @@ functions or objects with a `handleEvent` property whose value is a function.
20772077
In either case, the handler function is invoked with the `event` argument
20782078
passed to the `eventTarget.dispatchEvent()` function.
20792079
2080-
Async functions may be used as event listeners. If an async handler function
2081-
rejects, the rejection is captured and handled as described in
2082-
[`EventTarget` error handling][].
2080+
Event listeners may return promises, and async functions may be used as event
2081+
listeners. If a returned promise rejects or an async handler function rejects,
2082+
the rejection is captured and handled as described in [`EventTarget` error
2083+
handling][].
20832084
20842085
An error thrown by one handler function does not prevent the other handlers
20852086
from being invoked.
20862087
2087-
The return value of a handler function is ignored.
2088+
Other than promises, the return value of a handler function is ignored.
20882089
20892090
Handlers are always invoked in the order they were added.
20902091

0 commit comments

Comments
 (0)