diff --git a/main/index.js b/main/index.js index 71adf749..906d7995 100644 --- a/main/index.js +++ b/main/index.js @@ -37,5 +37,5 @@ ipc.init() function onOpen (e, torrentId) { e.preventDefault() - windows.main.send('addTorrent', torrentId) + windows.main.send('dispatch', 'addTorrent', torrentId) } diff --git a/main/menu.js b/main/menu.js index 1444a67f..641918c8 100644 --- a/main/menu.js +++ b/main/menu.js @@ -85,7 +85,7 @@ function getMenuTemplate () { properties: [ 'openFile', 'openDirectory', 'multiSelections' ] }, function (filenames) { if (!Array.isArray(filenames)) return - windows.main.send('seed', filenames) + windows.main.send('dispatch', 'seed', filenames) }) } }, @@ -99,7 +99,7 @@ function getMenuTemplate () { }, function (filenames) { if (!Array.isArray(filenames)) return filenames.forEach(function (filename) { - windows.main.send('addTorrent', filename) + windows.main.send('dispatch', 'addTorrent', filename) }) }) } diff --git a/renderer/index.js b/renderer/index.js index 7914242b..f42f45e6 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -210,12 +210,8 @@ function dispatch (action, ...args) { } function setupIpc () { - ipcRenderer.on('addTorrent', function (e, torrentId) { - dispatch('addTorrent', torrentId) - }) - - ipcRenderer.on('seed', function (e, files) { - dispatch('seed', files) + ipcRenderer.on('dispatch', function (e, action, ...args) { + dispatch(action, ...args) }) ipcRenderer.on('fullscreenChanged', function (e, isFullScreen) {