events: Fix checking of max listeners #2490

wants to merge 1 commit into


None yet

2 participants


EventEmitter.prototype.setMaxListeners(1) does not work as expected.
It works correctly with the argument(ex. 5, 100, ...) other than 1.

var EventEmitter = require('events').EventEmitter;
var ee = new EventEmitter();
ee.on('message', function() {});
ee.on('message', function() {}); // doesn't show warning against my expectation.
ee.on('message', function() {}); // show warning.

I fixed this issue by the way to check for max listeners after it set.

Thank you!


@tricknotes - Thanks! Can you sign the CLA?


I haven't signed yet.
Please wait a few days because I need to take counsel with my company.

I want to sign as soon as possible.


I have submitted!

@koichik koichik added a commit that closed this pull request Jan 9, 2012
@tricknotes tricknotes events: fix checking max listeners with `1`
Fixes #2490.
@koichik koichik closed this in 22d7fe1 Jan 9, 2012

@tricknotes - Thanks! It has landed in v0.6 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment