Files
bamboo/extend/event/index.js
T
2022-05-28 03:55:53 +08:00

17 lines
383 B
JavaScript

/**
* 事件插件
* 加载event文件夹下的事件
*/
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 => {
Object.keys(item.res).forEach(key => {
//载入所有事件
app.event.on(key, item.res[key])
})
})
}