mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-28 20:31:47 +01:00
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
388 B
TypeScript
20 lines
388 B
TypeScript
import type { InternalEvent } from "@yaakapp/api";
|
|
|
|
export class EventChannel {
|
|
#listeners = new Set<(event: InternalEvent) => void>();
|
|
|
|
emit(e: InternalEvent) {
|
|
for (const l of this.#listeners) {
|
|
l(e);
|
|
}
|
|
}
|
|
|
|
listen(cb: (e: InternalEvent) => void) {
|
|
this.#listeners.add(cb);
|
|
}
|
|
|
|
unlisten(cb: (e: InternalEvent) => void) {
|
|
this.#listeners.delete(cb);
|
|
}
|
|
}
|