chore: 添加 EventBus

* 並讓對話列表先用上了
This commit is contained in:
CrescentLeaf
2025-09-25 16:52:23 +08:00
parent c0c6c6ed1c
commit 8d739dd863
2 changed files with 27 additions and 8 deletions

12
client/EventBus.ts Normal file
View 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]()
}
}