class EventEmitter { // 实现代码 } function test(a) { console.log(a); } const event = new EventEmitter(); event.on("test", test);// 1 event.on("test", test);// 1 event.on("test", test);// 1 event.emit("test", 1);