diff --git a/lib/events.js b/lib/events.js index ee6e366716e..ee17a22c7e7 100644 --- a/lib/events.js +++ b/lib/events.js @@ -75,6 +75,7 @@ process.EventEmitter.prototype.addListener = function (type, listener) { return this; }; +process.EventEmitter.prototype.on = process.EventEmitter.prototype.addListener; process.EventEmitter.prototype.removeListener = function (type, listener) { if ('function' !== typeof listener) { diff --git a/test/simple/test-event-emitter-add-listeners.js b/test/simple/test-event-emitter-add-listeners.js index 3583fb10418..c824ec607d7 100644 --- a/test/simple/test-event-emitter-add-listeners.js +++ b/test/simple/test-event-emitter-add-listeners.js @@ -11,7 +11,7 @@ e.addListener("newListener", function (event, listener) { events_new_listener_emited.push(event); }); -e.addListener("hello", function (a, b) { +e.on("hello", function (a, b) { console.log("hello"); times_hello_emited += 1 assert.equal("a", a);