mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Experimental: 'on' as alias to 'addListener'
This commit is contained in:
1 parent
a6b8586e94
commit
515dc2161b
2 files changed
+2
-1
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user