MCPcopy
hub / github.com/jamiepine/voicebox / subscribeToServerLogs

Method subscribeToServerLogs

tauri/src/platform/lifecycle.ts:90–113  ·  view source on GitHub ↗
(callback: (entry: ServerLogEntry) => void)

Source from the content-addressed store, hash-verified

88 }
89
90 subscribeToServerLogs(callback: (entry: ServerLogEntry) => void): () => void {
91 let disposed = false;
92 let unlisten: (() => void) | null = null;
93
94 void listen<ServerLogEntry>('server-log', (event) => {
95 callback(event.payload);
96 })
97 .then((fn) => {
98 if (disposed) {
99 fn();
100 return;
101 }
102 unlisten = fn;
103 })
104 .catch((error) => {
105 console.error('Failed to subscribe to server logs:', error);
106 });
107
108 return () => {
109 disposed = true;
110 unlisten?.();
111 unlisten = null;
112 };
113 }
114}
115
116export const tauriLifecycle = new TauriLifecycle();

Callers

nothing calls this directly

Calls 3

callbackFunction · 0.85
catchMethod · 0.80
thenMethod · 0.80

Tested by

no test coverage detected