4.手写一个事件模型。题目给出以下部分

var em = new EventEmitter();
em.on("hello", function (name) {
console.log("Hello, " + name);
});
em.emit("hello", "world!");

打开console查看结果
源码: here