Files
goose/ui-v2/electron/preload.ts
Zane f3e586e724 Goose v2 base frontend (#2374)
Co-authored-by: Alex Hancock <alexhancock@block.xyz>
2025-04-28 10:20:00 -04:00

13 lines
429 B
TypeScript

import { contextBridge, ipcRenderer } from 'electron';
// Define the API interface
interface ElectronAPI {
copyToClipboard(text: string): Promise<void>;
}
// Expose protected methods that allow the renderer process to use
// the ipcRenderer without exposing the entire object
contextBridge.exposeInMainWorld('electronAPI', {
copyToClipboard: (text: string) => ipcRenderer.invoke('clipboard-copy', text),
} as ElectronAPI);