-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
16 lines (15 loc) · 808 Bytes
/
Copy pathpreload.js
File metadata and controls
16 lines (15 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('api', {
getSettings: () => ipcRenderer.invoke('get-settings'),
saveSettings: (s) => ipcRenderer.invoke('save-settings', s),
browseFolder: () => ipcRenderer.invoke('browse-folder'),
browseScript: () => ipcRenderer.invoke('browse-script'),
testConnection: () => ipcRenderer.invoke('test-connection'),
runBackup: (o) => ipcRenderer.invoke('run-backup', o),
cancelBackup: () => ipcRenderer.invoke('cancel-backup'),
openLogs: () => ipcRenderer.invoke('open-logs'),
minimize: () => ipcRenderer.invoke('minimize'),
close: () => ipcRenderer.invoke('close'),
onLog: (cb) => ipcRenderer.on('backup-log', (_, data) => cb(data)),
onDone: (cb) => ipcRenderer.on('backup-done', (_, data) => cb(data)),
})