-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
19 lines (17 loc) · 890 Bytes
/
preload.js
File metadata and controls
19 lines (17 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
onStateUpdate: (callback) => {
ipcRenderer.on('state-update', (_event, data) => callback(data));
},
onLogEntry: (callback) => {
ipcRenderer.on('log-entry', (_event, data) => callback(data));
},
getState: () => ipcRenderer.invoke('get-state'),
updateSettings: (settings) => ipcRenderer.invoke('update-settings', settings),
removeCondition: (name) => ipcRenderer.invoke('remove-condition', { name }),
resetConditions: () => ipcRenderer.invoke('reset-conditions'),
restartTunnel: () => ipcRenderer.invoke('restart-tunnel'),
testWebhook: (action) => ipcRenderer.invoke('test-webhook', action),
updatePayload: (action, fields) => ipcRenderer.invoke('update-payload', { action, fields }),
copyTunnelUrl: () => ipcRenderer.invoke('copy-tunnel-url'),
});