Skip to content

listenerCount()

Returns the number of listeners registered for a given event.

Example

typescript
const count = instance.listenerCount("foo");
// count: 2

Parameters

ParameterTypeDescription
eventstring | symbolThe event name. Expects an ESMitterEventName.

Returns

TypeDescription
numberThe number of listeners registered for the event.

Notes

  • If no listeners are registered for the event, 0 is returned.