1'use strict'; 2require('../common'); 3const assert = require('assert'); 4const EventEmitter = require('events'); 5 6const emitter = new EventEmitter(); 7 8assert.strictEqual(emitter.getMaxListeners(), EventEmitter.defaultMaxListeners); 9 10emitter.setMaxListeners(0); 11assert.strictEqual(emitter.getMaxListeners(), 0); 12 13emitter.setMaxListeners(3); 14assert.strictEqual(emitter.getMaxListeners(), 3); 15 16// https://github.com/nodejs/node/issues/523 - second call should not throw. 17const recv = {}; 18EventEmitter.prototype.on.call(recv, 'event', () => {}); 19EventEmitter.prototype.on.call(recv, 'event', () => {}); 20