sindresorhus / emittery

Simple and modern async event emitter
MIT License
1.74k stars 70 forks source link

Wrong listener count for Symbol event names #113

Closed xuxucode closed 8 months ago

xuxucode commented 8 months ago

listenerCount returns total count of all events instead of our given Symbol event.

For example:

import Emittery from "emittery"

const SYMBOL = Symbol()

let emittery = new Emittery()
emittery.on("hello", () => {})
emittery.on("world", () => {})

console.log("hello event count", emittery.listenerCount("hello"))
// => 1

console.log("symbol event count", emittery.listenerCount(SYMBOL))
// => 2, expected 0