You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many top-level functions in node:events that mirror their equivalents on the EventEmitter prototype, but also accept EventTarget arguments. (getEventListeners(), getMaxListeners(), etc.)
events.listenerCount() was previously deprecated on the basis of duplicating the functionality of EventEmitter.prototype.listenerCount(). However, there's no equivalent function on the EventTarget prototype, and it seems like this would be a good candidate to follow the others and become an agnostic utility function.
An alternative for this functionality exists via getEventListeners(...).length, but since listenerCount() already exists (and has an analogue on the EventEmitter prototype that isn't going anywhere), it seems like this would be a low-effort improvement.