1.加载插件

This commit is contained in:
robin
2022-05-28 03:55:53 +08:00
parent 96333ae7a9
commit 96bfa3f2d3
15 changed files with 1368 additions and 1066 deletions
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
path:"app/*/event/*.js"
}
+16
View File
@@ -0,0 +1,16 @@
/**
* 事件插件
* 加载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])
})
})
}
-4
View File
@@ -1,4 +0,0 @@
//加载配置文件
module.exports = (app) => {
}