Method
subscribeToServerLogs
(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 | |
| 116 | export const tauriLifecycle = new TauriLifecycle(); |
Callers
nothing calls this directly
Tested by
no test coverage detected