MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / subscribeDesktopEvents

Function subscribeDesktopEvents

desktop/pi-desktop-runtime.ts:156–176  ·  view source on GitHub ↗
(listener: (event: DesktopEvent) => void)

Source from the content-addressed store, hash-verified

154}
155
156export function subscribeDesktopEvents(listener: (event: DesktopEvent) => void) {
157 const unsubscribeLocal = subscribeLocalDesktopEvents(listener)
158 const unsubscribeHost = subscribeRuntimeHostEvents((event) => {
159 if (event.type === 'internal-thread-update') {
160 markInternalThreadUpdate(event.sessionPath)
161 return
162 }
163
164 if (event.type !== 'thread-update') {
165 listener(event)
166 return
167 }
168
169 enqueueHostThreadUpdate(event, listener)
170 })
171
172 return () => {
173 unsubscribeLocal()
174 unsubscribeHost()
175 }
176}
177
178export function startNewThread(request: ComposerStateRequest = {}) {
179 return invokeRuntimeHost('startNewThread', { request: withComposerModeSettings(request) })

Callers

nothing calls this directly

Calls 3

markInternalThreadUpdateFunction · 0.90
enqueueHostThreadUpdateFunction · 0.85

Tested by

no test coverage detected