-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
18 lines (17 loc) · 792 Bytes
/
preload.js
File metadata and controls
18 lines (17 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const { contextBridge, ipcRenderer, dialog } = require('electron');
contextBridge.exposeInMainWorld('electron', {
openSettings: () => ipcRenderer.invoke('open-settings'),
getSettings: async () => {
const settings = await ipcRenderer.invoke('get-settings');
console.log('Got settings in preload:', settings);
return settings;
},
saveSettings: async (settings) => {
console.log('Saving settings in preload:', settings);
return await ipcRenderer.invoke('save-settings', settings);
},
compressImages: (filePath) => ipcRenderer.invoke('compress-images', filePath),
showDirectoryPicker: () => ipcRenderer.invoke('show-directory-picker'),
openPath: (path) => ipcRenderer.invoke('open-path', path),
copyFile: (path) => ipcRenderer.invoke('copy-file', path)
});