1.加载插件
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
path:"app/*/event/*.js"
|
||||
}
|
||||
@@ -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])
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
//加载配置文件
|
||||
module.exports = (app) => {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user