1'use strict'; 2 3require('../common'); 4const assert = require('assert'); 5const EventEmitter = require('events'); 6 7const emitter = new EventEmitter(); 8emitter.on('foo', () => {}); 9emitter.on('foo', () => {}); 10emitter.on('baz', () => {}); 11// Allow any type 12emitter.on(123, () => {}); 13 14assert.strictEqual(EventEmitter.listenerCount(emitter, 'foo'), 2); 15assert.strictEqual(emitter.listenerCount('foo'), 2); 16assert.strictEqual(emitter.listenerCount('bar'), 0); 17assert.strictEqual(emitter.listenerCount('baz'), 1); 18assert.strictEqual(emitter.listenerCount(123), 1); 19