[v12.x] events: assume an EventEmitter if emitter.on is a function#35818
[v12.x] events: assume an EventEmitter if emitter.on is a function#35818lpinca wants to merge 1 commit intonodejs:v12.x-stagingfrom
Conversation
Assume that the `emitter` argument of `EventEmitter.once()` is an `EventEmitter` if `emitter.on` is a function. Refs: nodejs@4b3654e923e7c3c2 Refs: websockets/ws#1795
|
This fixes a breaking change introduced in 9150c4dc72. The |
|
@lpinca note that that PR was added in order to support |
|
I don't think this use case (of something that behaves like both eventemitter and eventtarget) is common and a quick GitHub search doesn't find interesting results. I am fine with landing this change as semver-patch. Preferring The biggest difference here is error handling (adding the |
|
Also fwiw I am fine with this change in master (and not just 12.x) |
|
On master, v15.x, and v14.x it's already like this. See linked refs. |
|
@lpinca Ah lmao, I am the author of that and absolutely forgot about that 😅 |
This comment has been minimized.
This comment has been minimized.
|
@nodejs/events can we please get one more sign off on this |
|
pinging @nodejs/events can we please get another sign-off here? maybe @mcollina ? |
|
Landed in a211c70e04aa |
Assume that the `emitter` argument of `EventEmitter.once()` is an `EventEmitter` if `emitter.on` is a function. Refs: 4b3654e923e7c3c2 Refs: websockets/ws#1795 PR-URL: #35818 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Assume that the
emitterargument ofEventEmitter.once()is anEventEmitterifemitter.onis a function.Refs: 4b3654e923e7c3c2
Refs: websockets/ws#1795
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes