socketio封装

This commit is contained in:
robin
2022-05-31 06:52:00 +08:00
parent 96bfa3f2d3
commit c764e7097d
9 changed files with 77 additions and 4 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ const config = require("./config")
const EventEmitter = require('events');
module.exports = async (app) => {
app.event = new EventEmitter()
const evList = await app.load(config.path)
evList.forEach(item => {
const list = await app.load(config.path)
list.forEach(item => {
Object.keys(item.res).forEach(key => {
//载入所有事件
app.event.on(key, item.res[key])