35 lines
1.5 KiB
JavaScript
35 lines
1.5 KiB
JavaScript
/* ─── Preload Script ─────────────────────────────────────────────────────────
|
|
* Context bridge a renderer és main process között.
|
|
* Exponálja a natív API-kat a weboldalnak.
|
|
* ──────────────────────────────────────────────────────────────────────────── */
|
|
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
// Config
|
|
getConfig: () => ipcRenderer.invoke('get-config'),
|
|
reloadConfig: () => ipcRenderer.invoke('reload-config'),
|
|
|
|
// Action futtatás
|
|
executeAction: (action) => ipcRenderer.invoke('execute-action', action),
|
|
executeActions: (actions) => ipcRenderer.invoke('execute-actions', actions),
|
|
|
|
// Clipboard
|
|
getClipboardText: () => ipcRenderer.invoke('get-clipboard-text'),
|
|
setClipboardText: (text) => ipcRenderer.invoke('set-clipboard-text', text),
|
|
|
|
// System stats
|
|
getSystemStats: () => ipcRenderer.invoke('get-system-stats'),
|
|
|
|
// Fullscreen
|
|
toggleFullscreen: () => ipcRenderer.invoke('toggle-fullscreen'),
|
|
|
|
// Eredmény események (pl. shell output)
|
|
onShellResult: (callback) => {
|
|
ipcRenderer.on('shell-result', (event, data) => callback(data));
|
|
},
|
|
onClipboardResult: (callback) => {
|
|
ipcRenderer.on('clipboard-result', (event, data) => callback(data));
|
|
},
|
|
});
|