events: Fix checking of max listeners #2490

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@tricknotes

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.setMaxListeners(1);
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!

@koichik

@tricknotes - Thanks! Can you sign the CLA?

@tricknotes

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.

@tricknotes

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.
22d7fe1
@koichik koichik closed this in 22d7fe1 Jan 9, 2012
@koichik

@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