mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-11 00:30:57 +00:00
13 lines
462 B
TypeScript
13 lines
462 B
TypeScript
type Listener = (sessionId: string) => void;
|
|
const listeners = new Set<Listener>();
|
|
|
|
/** Renderer-local fan-out of the terminal's existing completion detection. */
|
|
export function publishTerminalCommandCompletion(sessionId: string): void {
|
|
for (const listener of listeners) listener(sessionId);
|
|
}
|
|
|
|
export function subscribeTerminalCommandCompletion(listener: Listener): () => void {
|
|
listeners.add(listener);
|
|
return () => { listeners.delete(listener); };
|
|
}
|