removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -1,10 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
class TarinaiEventBus {
|
||||
constructor({ historyLimit = 180 } = {}) {
|
||||
constructor() {
|
||||
this.handlers = new Map();
|
||||
this.history = [];
|
||||
this.historyLimit = historyLimit;
|
||||
}
|
||||
|
||||
on(type, handler) {
|
||||
|
|
@ -28,8 +26,6 @@ class TarinaiEventBus {
|
|||
emit(type, detail = {}) {
|
||||
if (!type) return null;
|
||||
const event = { type, detail: detail || {}, at: performance?.now?.() ?? Date.now() };
|
||||
this.history.unshift(event);
|
||||
if (this.history.length > this.historyLimit) this.history.length = this.historyLimit;
|
||||
const direct = this.handlers.get(type);
|
||||
if (direct) for (const handler of [...direct]) this.safeCall(handler, event);
|
||||
const wildcard = this.handlers.get("*");
|
||||
|
|
@ -41,12 +37,6 @@ class TarinaiEventBus {
|
|||
try { handler(event); }
|
||||
catch (err) { console.error("event handler failed", event.type, err); }
|
||||
}
|
||||
|
||||
recent(filter = null, limit = 40) {
|
||||
const list = filter ? this.history.filter(ev => ev.type === filter) : this.history;
|
||||
return list.slice(0, limit);
|
||||
}
|
||||
}
|
||||
|
||||
window.TarinaiEventBus = TarinaiEventBus;
|
||||
window.TarinaiEvents = window.TarinaiEvents || new TarinaiEventBus();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue