chore: 添加 EventBus
* 並讓對話列表先用上了
This commit is contained in:
12
client/EventBus.ts
Normal file
12
client/EventBus.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export default class EventBus {
|
||||
static events: { [key: string]: () => void } = {}
|
||||
static on(eventName: string, func: () => void) {
|
||||
this.events[eventName] = func
|
||||
}
|
||||
static off(eventName: string) {
|
||||
delete this.events[eventName]
|
||||
}
|
||||
static emit(eventName: string) {
|
||||
this.events[eventName]()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user