joyent/node — pull request #4280 by teramako (2012-11-14 12:09:09+00:00)
Title: EventEmitter handles an object has 'handleEvent' property like DOM Event

This patch allows addListener an object has `handleEvent` method for binding the current execution context to the object.

example:

var events = require("events");
var e = new event.EventEmitter();
var handler = {
name: "handler",
handleEvent: function(type, args) {
console.log(type, this.name);
}
};
e.on("hello", handler);
e.emit("hello");