Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventEmitter.listener() returns different function then that one registered #171

Closed
Flarna opened this issue May 18, 2016 · 2 comments
Closed

Comments

@Flarna
Copy link
Member

Flarna commented May 18, 2016

If I register a listener using once() and then read the listener array using listeners() I would expect to get an array with one entry pointing to my listener.
But actually listeners(eventName)[0].listener is actually pointing to my function as EventEmitter wrapped my listener for the once handling.

If I register a listener using on() then listeners(eventName)[0] points to my listener.

Is this intended?

@addaleax
Copy link
Member

Some people have seen it as a bug, there was a PR at the core repository that would have fixed it: nodejs/node#5564

That proposal got a bit lost because there was another PR that did a similar thing, but only for the 'removeListener' event, not .listeners(). I think it would be fair to open a issue at https://github.com/nodejs/node/issues so that, at the very least, this problem does not get lost. Care to do that? :)

@Flarna
Copy link
Member Author

Flarna commented May 19, 2016

ok, thanks. created nodejs/node#6873

@Flarna Flarna closed this as completed May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants