The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type { DesktopBridge } from "@t3tools/contracts"; |
| 2 | |
| 3 | const SNAP_SHOT_FOCUS_EVENT = "t3code:focus-composer"; |
| 4 | |
| 5 | export function dispatchSnapShotComposerFocus(): void { |
| 6 | if (typeof window === "undefined") return; |
| 7 | window.dispatchEvent(new Event(SNAP_SHOT_FOCUS_EVENT)); |
| 8 | } |
| 9 | |
| 10 | export function subscribeSnapShotComposerFocus(listener: () => void): () => void { |
| 11 | if (typeof window === "undefined") return () => {}; |
| 12 | window.addEventListener(SNAP_SHOT_FOCUS_EVENT, listener); |
| 13 | return () => window.removeEventListener(SNAP_SHOT_FOCUS_EVENT, listener); |
| 14 | } |
| 15 | |
| 16 | export function getDesktopSnapShotBridge(): DesktopBridge | undefined { |
| 17 | return typeof window === "undefined" ? undefined : window.desktopBridge; |
| 18 | } |