mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-24 11:34:55 +01:00
15 lines
339 B
TypeScript
15 lines
339 B
TypeScript
import type { InternalEvent } from "@yaakapp/api";
|
|
import EventEmitter from "node:events";
|
|
|
|
export class EventChannel {
|
|
emitter: EventEmitter = new EventEmitter();
|
|
|
|
emit(e: InternalEvent) {
|
|
this.emitter.emit("__plugin_event__", e);
|
|
}
|
|
|
|
listen(cb: (e: InternalEvent) => void) {
|
|
this.emitter.on("__plugin_event__", cb);
|
|
}
|
|
}
|