From 90a703e4c836fa53aeea1ae82ef28502cb3ea15a Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 24 Aug 2020 13:11:23 -0700 Subject: [PATCH] events: allow use of AbortController with once Allows an AbortSignal to be passed in to events.once() to cancel waiting on an event. Signed-off-by: James M Snell --- doc/api/events.md | 30 ++++++++++- lib/events.js | 53 +++++++++++++++++- lib/internal/validators.js | 10 ++++ test/parallel/test-events-once.js | 90 ++++++++++++++++++++++++++++++- 4 files changed, 179 insertions(+), 4 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 3004d5bbb3c9fc..7c756e6df9eab8 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -825,7 +825,7 @@ class MyClass extends EventEmitter { } ``` -## `events.once(emitter, name)` +## `events.once(emitter, name[, options])`