var em = new EventEmitter(); em.on("hello", function (name) { console.log("Hello, " + name); }); em.emit("hello", "world!");
打开console查看结果 源码: here