MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / handler

Method handler

packages/message/message_queue.ts:57–68  ·  view source on GitHub ↗
(topic: string, { action, message }: { action: string; message: any })

Source from the content-addressed store, hash-verified

55 }
56
57 handler(topic: string, { action, message }: { action: string; message: any }) {
58 LoggerCore.getInstance()
59 .logger({ service: "messageQueue" })
60 .trace("messageQueueHandler", { action, topic, message });
61 switch (action) {
62 case "message":
63 this.EE.emit(topic, message);
64 break;
65 default:
66 throw new Error("action not found");
67 }
68 }
69
70 subscribe<T>(topic: string, handler: (msg: T) => void) {
71 this.EE.on(topic, handler);

Callers 1

constructorMethod · 0.95

Calls 4

traceMethod · 0.80
getInstanceMethod · 0.80
emitMethod · 0.65
loggerMethod · 0.45

Tested by

no test coverage detected