Refactoring Electron IPC
This commit is contained in:
20
src/renderer/ipc/AppIPC.js
Normal file
20
src/renderer/ipc/AppIPC.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const Constants = require('../../constants');
|
||||
|
||||
const addListeners = (ipcMain, closeApplication, setWindowVisibility) => {
|
||||
ipcMain.on(Constants.IPC_Shutdown, () => {
|
||||
closeApplication();
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Show_Window, () => {
|
||||
setWindowVisibility(true);
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Show_Window + '_sync', event => {
|
||||
setWindowVisibility(true);
|
||||
event.returnValue = true;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
addListeners
|
||||
};
|
||||
Reference in New Issue
Block a user