Use ipcRenderer.sendTo to get rid of routers in main process
This commit is contained in:
parent
a58b84bbd7
commit
ba315248e0
5 changed files with 33 additions and 50 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue