From 77ea039acaaab621c6f4547d1fc401aa8e4c4721 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Fri, 7 Nov 2025 16:13:25 -0500 Subject: [PATCH] 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. --- doc/api/events.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 3994968031428e..b70e8cacb982c4 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -2077,14 +2077,15 @@ functions or objects with a `handleEvent` property whose value is a function. In either case, the handler function is invoked with the `event` argument passed to the `eventTarget.dispatchEvent()` function. -Async functions may be used as event listeners. If an async handler function -rejects, the rejection is captured and handled as described in -[`EventTarget` error handling][]. +Event listeners may return promises, and async functions may be used as event +listeners. If a returned promise rejects or an async handler function rejects, +the rejection is captured and handled as described in [`EventTarget` error +handling][]. An error thrown by one handler function does not prevent the other handlers from being invoked. -The return value of a handler function is ignored. +Other than promises, the return value of a handler function is ignored. Handlers are always invoked in the order they were added.