Files
Toju/electron/preload.js
2025-12-28 08:23:30 +01:00

20 lines
792 B
JavaScript

const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
// Window controls
minimizeWindow: () => ipcRenderer.send('window-minimize'),
maximizeWindow: () => ipcRenderer.send('window-maximize'),
closeWindow: () => ipcRenderer.send('window-close'),
// Desktop capturer for screen sharing
getSources: () => ipcRenderer.invoke('get-sources'),
// App data path for SQLite storage
getAppDataPath: () => ipcRenderer.invoke('get-app-data-path'),
// File system operations for database persistence
readFile: (filePath) => ipcRenderer.invoke('read-file', filePath),
writeFile: (filePath, data) => ipcRenderer.invoke('write-file', filePath, data),
fileExists: (filePath) => ipcRenderer.invoke('file-exists', filePath),
});