Event Listners Count always return 0 despite of adding listners
opened this issue · comments
signInEvent = Event<MasterViewController>()
//button touchup inside event
btnSignIn.onTap { [weak self] in
if self == nil {
return
}
self?.signInEvent?.emit(SigninController()) //Emit data Here
print(self?.signInEvent?.listenerCount) //Always return 0
}
//Listner
let listner = signInEvent?.on({ (data) in
print(data)
})
Hello! What version of Swift and EmitterKit are you using?
Are you forgetting to retain your signInEvent
listener?
If so, this is a duplicate of #27. Please confirm. :)
PS: The listenerCount
property is deprecated. You should use getListeners().count
if you want to know how many listeners exist that have no target. I may consider adding countListeners(target)
and countAllListeners()
methods if lots of people want them.