Files
goose/ui-v2/electron/preload.ts
2025-05-19 10:45:42 -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);