This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Description
// Constructor of some model class.
function WebSite(domain) {
this.domain = domain;
}
// Inheriting from EventEmitter.
var EventEmitter = require('events').EventEmitter;
WebSite.prototype = new EventEmitter();
// Create instance.
var website = new WebSite("google.com");
// Add event handler.
website.on("ping", function() { console.log("pong"); });
// Try to emit event.
website.emit("ping");
> TypeError: Object google.com has no method 'enter'
at EventEmitter.emit (events.js:80:19)
...
// What? How? Hmm..
What happens here is that EventEmitter uses a field named 'domain' to store its domain, and tries to call this.domain.enter(), which is neither documented, nor expected.
Solution: At least rename it to '_domain' (like '_events', internal by convention).
Background: I have a Mongoose model with field 'domain' and cannot rename it easily as the database depends on it. Therefore I have no choice but to get back to Node v0.6, until this bug is fixed. Please, help!