refactor: implement ipcRenderer.sendTo in native code for better performance (#14285)
This commit is contained in:
parent
e6e3ccfc50
commit
c23e7fa101
7 changed files with 54 additions and 25 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue