import { chan, multi } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; export class EventBus implements EventEmitter { private readonly c = chan(); private readonly caster = multi(this.c); async emit(event: T) { await this.c.put(event); } onChange() { return this.caster.copy(); } } export type EventEmitter = { emit: (event: T) => void; };