Skip to content

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

Closed

Description

@Flarna

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?

Activity

  1. addaleax commented on May 18, 2016

    @addaleax
    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? :)

  2. Flarna commented on May 19, 2016

    @Flarna
    MemberAuthor

    ok, thanks. created nodejs/node#6873

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions