refactor: implement ipcRenderer.sendTo in native code for better performance (#14285)

This commit is contained in:
Milan Burda 2018-08-24 23:14:39 +02:00 committed by Samuel Attard
parent e6e3ccfc50
commit c23e7fa101
7 changed files with 54 additions and 25 deletions

View file

@ -19,19 +19,11 @@ ipcRenderer.sendToHost = function (...args) {
}
ipcRenderer.sendTo = function (webContentsId, channel, ...args) {
if (typeof webContentsId !== 'number') {
throw new TypeError('First argument has to be webContentsId')
}
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', false, webContentsId, channel, ...args)
return binding.sendTo(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)
return binding.sendTo(true, webContentsId, channel, args)
}
const removeAllListeners = ipcRenderer.removeAllListeners.bind(ipcRenderer)