-
-
Notifications
You must be signed in to change notification settings - Fork 74
/
preload.js
36 lines (34 loc) · 1.19 KB
/
preload.js
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
28
29
30
31
32
33
34
35
36
const { contextBridge, ipcRenderer, shell, app } = require('electron');
ipcRenderer.on('console', (event, data) => {
console[data.method].apply(console, data.args)
});
contextBridge.exposeInMainWorld('api', {
initipc: ipcMessageEvent => {
ipcRenderer.on('message', ipcMessageEvent);
},
openExternal: url => {
ipcRenderer.invoke('openExternal', {"url": url});
},
quit: () => ipcRenderer.send("quit"),
showPicker: current_path => {
return ipcRenderer.invoke('showPicker', {"current_path": current_path});
},
showPickerForPlugin: select_type => {
return ipcRenderer.invoke('showPickerForPlugin', {"select_type": select_type});
},
addPlugin: path => {
return ipcRenderer.invoke('addPlugin', {"path": path});
},
checkPlugin: path => {
return ipcRenderer.invoke('checkPlugin', {"path": path});
},
removePlugin: pluginid => {
return ipcRenderer.invoke('removePlugin', {"id": pluginid});
},
saveconfig: (config, reload) => {
ipcRenderer.send("saveconfig", {"config": config, "reload": reload});
},
generateCrypto: () => {
return ipcRenderer.invoke('generateCrypto');
}
})