monerod-gui/app/preload.js

36 lines
1,022 B
JavaScript
Raw Normal View History

// preload.js
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
startMonerod: (args) => {
ipcRenderer.invoke('start-monerod', args);
},
onMoneroStdout: (callback) => {
ipcRenderer.on('monero-stdout', callback);
},
onMoneroClose: (callback) => {
ipcRenderer.on('monero-close', callback);
2024-10-01 18:45:10 +00:00
},
getMoneroVersion: () => {
ipcRenderer.invoke('get-monero-version');
},
onMoneroVersion: (callback) => {
ipcRenderer.on('monero-version', callback);
},
onMoneroVersionError: (callback) => {
ipcRenderer.on('monero-version-error', callback);
2024-10-07 21:47:52 +00:00
},
downloadMonerod: (downloadUrl, destination) => {
ipcRenderer.invoke('download-monerod', downloadUrl, destination);
},
onDownloadProgress: (callback) => {
ipcRenderer.on('download-progress', callback);
2024-10-09 18:53:38 +00:00
},
selectFolder: () => {
ipcRenderer.invoke('select-folder')
},
onSelectedFolder: (callback) => {
ipcRenderer.on('selected-folder', callback);
}
});