Closed aleclarson closed 6 years ago
Should the listenerCount
return number of all listeners? Sum listeners for all the targets?
I think it's rather useless to return all listeners of an event (but maybe I'm wrong?). Instead, we should probably just add a getListeners(target?)
method for getting the array of listeners for the given target (or the array of listeners without a target if no target is given).
Then you can do event.getListeners(nil).count
and the semantics are a little clearer.
Added getListeners
in v5.2.0 🎉
ac1c9c96fba3d548c69bed012c699ed35b7ab3c5
The
listenerCount
property of theEvent
class is currently computed with_listeners.count
. That's not right, since the_listeners
dictionary uses target identifiers for its keys; not listener identifiers.This will get fixed at the same time as #43.