mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: implement ipcRenderer.sendTo in native code for better performance (#14285)
This commit is contained in:
committed by
Samuel Attard
parent
e6e3ccfc50
commit
c23e7fa101
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user