Use ipcRenderer.sendTo to get rid of routers in main process

This commit is contained in:
Cheng Zhao 2016-05-28 21:13:00 +09:00
parent a58b84bbd7
commit ba315248e0
5 changed files with 33 additions and 50 deletions

View file

@ -23,7 +23,15 @@ ipcRenderer.sendTo = function (webContentsId, channel, ...args) {
throw new TypeError(`First argument has to be webContentsId`)
}
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', webContentsId, channel, ...args)
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', false, webContentsId, channel, ...args)
}
ipcRenderer.sendToAll = function (webContentsId, channel, ...args) {
if (typeof webContentsId !== 'number') {
throw new TypeError(`First argument has to be webContentsId`)
}
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', true, webContentsId, channel, ...args)
}
module.exports = ipcRenderer