@devries-cameron20 / t3code Mirror · read-only
Fork 0

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, 03:37 UTC

main
ts 16 lines 750 Bytes
Raw
1 import type { DesktopPreviewRecordingFrame } from "@t3tools/contracts";
2 import { contextBridge, ipcRenderer } from "electron";
3
4 import { PREVIEW_PICTURE_IN_PICTURE_FRAME_CHANNEL } from "./ipc/channels.ts";
5
6 contextBridge.exposeInMainWorld("previewPictureInPicture", {
7 onFrame: (listener: (frame: DesktopPreviewRecordingFrame) => void) => {
8 const wrappedListener = (_event: Electron.IpcRendererEvent, frame: unknown) => {
9 if (typeof frame !== "object" || frame === null) return;
10 listener(frame as DesktopPreviewRecordingFrame);
11 };
12 ipcRenderer.on(PREVIEW_PICTURE_IN_PICTURE_FRAME_CHANNEL, wrappedListener);
13 return () =>
14 ipcRenderer.removeListener(PREVIEW_PICTURE_IN_PICTURE_FRAME_CHANNEL, wrappedListener);
15 },
16 });