This commit is contained in:
33333-33333 2026-06-29 21:02:04 +09:00
commit e00bfd8879
51 changed files with 1203 additions and 833 deletions

View file

@ -6,21 +6,13 @@ class TarinaiEventBus {
}
on(type, handler) {
if (!type || typeof handler !== "function") return () => {};
if (!type || typeof handler !== "function") return;
let list = this.handlers.get(type);
if (!list) {
list = new Set();
this.handlers.set(type, list);
}
list.add(handler);
return () => this.off(type, handler);
}
off(type, handler) {
const list = this.handlers.get(type);
if (!list) return;
list.delete(handler);
if (!list.size) this.handlers.delete(type);
}
emit(type, detail = {}) {