-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpreload.js
More file actions
30 lines (29 loc) · 1009 Bytes
/
preload.js
File metadata and controls
30 lines (29 loc) · 1009 Bytes
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
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld(
'localApi', {
sendAction: (action) => {
ipcRenderer.send('action', action);
},
sendNodeForm: (formData) => {
ipcRenderer.send('node-form', formData);
},
sendGoHome: (port) => {
ipcRenderer.send('go-home', port);
},
onSelectedDirectory: (callback) => {
ipcRenderer.on('selected-directory', (e, ...args) => callback(args));
},
onUpdateAvailable: (callback) => {
ipcRenderer.on('update-available', (e, updateInfo) => callback(updateInfo));
},
openDownloadUrl: (url) => {
ipcRenderer.send('open-download-url', url);
},
onBootedNodes: (callback) => {
ipcRenderer.on('booted-nodes', (e, nodes) => callback(nodes));
},
loadBootedNodes: () => {
ipcRenderer.send('load-booted-nodes');
}
}
);