class EventEmitter { constructor(){ } on() { } off() { } emit() { } } let man1 = { name: 'xixi', age: 22 } let man2 = { name: 'haha', age: 25 } // 测试 let eventBus = new EventEmitter() let fn1 = function(name, age) { console.log(`${name} ${age}`) } let fn2 = function(name, age) { console.log(`hello, ${name} ${age}`) } eventBus.on('aaa', fn1) eventBus.on('aaa', fn2) eventBus.emit('aaa', false, '布兰', 12) // '布兰 12' // 'hello, 布兰 12'