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

events: handle inherited properties properly #2350

Commits on Nov 15, 2015

  1. events: handle inherited properties properly

    As of now, the events module considers inherited properties as one of the
    valid types, by default.
    
        > process.version
        'v3.0.0'
        > events.EventEmitter.listenerCount(new events.EventEmitter(), 'toString')
        1
    
    This patch makes sure that the inherited properties are considered as
    normal types and they will not be counted unless explicitly added.
    
        > process.version
        'v4.0.0-pre'
        > events.EventEmitter.listenerCount(new events.EventEmitter(), 'toString')
        0
        > const emitter = new events.EventEmitter();
        undefined
        > emitter.on('toString', function() {});
        EventEmitter {
          domain:
           Domain {
             domain: null,
             _events: { error: [Function] },
             _eventsCount: 1,
             _maxListeners: undefined,
             members: [] },
          _events: { toString: [Function] },
          _eventsCount: 1,
          _maxListeners: undefined }
        > events.EventEmitter.listenerCount(emitter, 'toString')
        1
    thefourtheye committed Nov 15, 2015
    Configuration menu
    Copy the full SHA
    85b2939 View commit details
    Browse the repository at this point in the history