-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpreload.js
More file actions
27 lines (23 loc) · 1.08 KB
/
Copy pathpreload.js
File metadata and controls
27 lines (23 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('insomnia', {
// Status
getStatus: () => ipcRenderer.invoke('get-status'),
toggleAwake: () => ipcRenderer.invoke('toggle-awake'),
onStatusUpdate: (callback) => {
ipcRenderer.on('status-update', (_, status) => callback(status));
},
// Apps
addApp: (appData) => ipcRenderer.invoke('add-app', appData),
removeApp: (exe) => ipcRenderer.invoke('remove-app', exe),
toggleApp: (exe) => ipcRenderer.invoke('toggle-app', exe),
getInstalledApps: () => ipcRenderer.invoke('get-installed-apps'),
browseExe: () => ipcRenderer.invoke('browse-exe'),
// Integrations
getAvailableIntegrations: () => ipcRenderer.invoke('get-available-integrations'),
addIntegration: (id) => ipcRenderer.invoke('add-integration', id),
removeIntegration: (id) => ipcRenderer.invoke('remove-integration', id),
toggleIntegration: (id) => ipcRenderer.invoke('toggle-integration', id),
// Startup
getStartup: () => ipcRenderer.invoke('get-startup'),
toggleStartup: () => ipcRenderer.invoke('toggle-startup')
});