This repository has been archived on 2025-09-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
repertory-ui/src/renderer/ipc/DaemonIPC.js

47 lines
1.1 KiB
JavaScript

const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, standardIPCReply) => {
ipcMain.on(Constants.IPC_Check_Daemon_Version, (event, data) => {
helpers
.checkDaemonVersion(data.Version, data.Provider)
.then(code => {
standardIPCReply(event, Constants.IPC_Check_Daemon_Version_Reply, {
Valid: (code === 0),
Code: code,
});
})
.catch(e => {
standardIPCReply(event, Constants.IPC_Check_Daemon_Version_Reply, {
Valid: false,
}, e);
});
});
ipcMain.on(Constants.IPC_Check_Daemon_Version + '_sync', (event, data) => {
helpers
.checkDaemonVersion(data.Version, data.Provider)
.then(code => {
event.returnValue = {
data: {
Success: true,
Valid: (code === 0),
Code: code,
},
};
})
.catch(e => {
event.returnValue = {
data: {
Error: e.toString(),
Success: false,
Valid: false
},
};
});
});
};
module.exports = {
addListeners
};