const Constants = require('../../constants'); const helpers = require('../../helpers'); const addListeners = (ipcMain, {standardIPCReply}) => { ipcMain.on(Constants.IPC_Export_Skylinks, (event, data) => { helpers .exportSkylinks(data.Version, data.Paths) .then(result => { standardIPCReply(event, Constants.IPC_Export_Skylinks_Reply, { Result: result, }); }) .catch(error => { standardIPCReply(event, Constants.IPC_Export_Skylinks_Reply, {}, error); }); }); ipcMain.on(Constants.IPC_Grab_Skynet_Tree, (event, data) => { helpers .grabSkynetFileTree(data.Version) .then(result => { standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, { Result: result, }); }) .catch(error => { standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {}, error); }); }); ipcMain.on(Constants.IPC_Import_Skylinks, (event, data) => { helpers .importSkylinks(data.Version, data.JsonArray) .then(result => { standardIPCReply(event, Constants.IPC_Import_Skylinks_Reply, { Result: result, }); }) .catch(error => { standardIPCReply(event, Constants.IPC_Import_Skylinks_Reply, {}, error); }); }); }; module.exports = { addListeners };