Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

EventEmitter::listeners() returns "[" when no listeners available. #6

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants

skenqbx commented Mar 26, 2012

Hello,

there was a naming conflict in class EventEmitter, listeners was a function and an array, which resulted in the function returning "[" instead of an empty array when no listeners for an event are found.

@skenqbx skenqbx closed this Mar 26, 2012

Owner

igorw commented Mar 26, 2012

What's the status on this? Where were you using this? What is extending the EventEmitter with its own listeners variable?

skenqbx commented Mar 26, 2012

I actually tried to use an event emitter as a proxy object for dnode.

So, problem solved. Thanks for asking.

skenqbx commented Mar 26, 2012

Example, with dnode:

class Proxy extends EventEmitter {
}
$proxy = new Proxy();
$dnode = new DNode\DNode($proxy);

I now use an $emitter member variable, so dnode does not have to sync the event emitters members, and i don't have a strange behavior when calling listeners() for events that have no listeners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment