{"html":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=utf-8>\n </head>\n <body>\n \t\n <script type=\"text/javascript\">\n class EventEmitter {\n // 补全代码\n constructor() {\n this.eventList = {}\n }\n\n on(key, callback) {\n if(!this.eventList[key]) {\n this.eventList[key] = [callback]\n }else {\n this.eventList[key].push(callback)\n }\n }\n\n emit(key) {\n const callbacks = this.eventList[key]\n\n callbacks && callbacks.forEach(callback => callback())\n }\n }\n </script>\n </body>\n</html>","css":"","js":""}