Skip to content

EventEmitter gets TypeError if EventEmitter.prototype.addListener is called directly.  #523

Closed
@yosuke-furukawa

Description

@yosuke-furukawa

I got following TypeError. the detail is here (sequelize/sequelize#2966).

TypeError: undefined is not a function
     at Promise.addListener (events.js:154:18)
     at Promise.on (/Users/yosuke/go/src/github.com/yosuke-furukawa/Hexi/node_modules/sequelize/lib/promise.js:118:31)

I think Sequelize module is wrong, EventEmitter.prototype.addListener should not be called directly. However, I don't think this error message is easy to understand. And io.js seems to break node.js compatible on events.

I have 4 options, I would like to discuss about the behavior.

  1. If this.getMaxListeners is undefined, events module prints helpful message like "EventEmitter.prototype.addListener should not called directly."
  2. If this.getMaxListeners is undefined, return the default EventEmitter.defaultMaxListeners.
    1. + 2.
  3. Keep this behavior.

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