Simplify the implementation of sendToAll
This commit is contained in:
parent
de001a9bbf
commit
5f3fdbe635
3 changed files with 9 additions and 20 deletions
|
@ -71,20 +71,15 @@ let wrapWebContents = function (webContents) {
|
|||
webContents.setMaxListeners(0)
|
||||
|
||||
// WebContents::send(channel, args..)
|
||||
webContents.send = function (channel, ...args) {
|
||||
if (channel == null) {
|
||||
throw new Error('Missing required channel argument')
|
||||
}
|
||||
return this._send(channel, args)
|
||||
}
|
||||
|
||||
// WebContents::sendToAll(channel, args..)
|
||||
webContents.sendToAll = function (channel, ...args) {
|
||||
const sendWrapper = (allFrames, channel, ...args) => {
|
||||
if (channel == null) {
|
||||
throw new Error('Missing required channel argument')
|
||||
}
|
||||
return this._sendToAll(channel, args)
|
||||
return webContents._send(allFrames, channel, args)
|
||||
}
|
||||
webContents.send = sendWrapper.bind(null, false)
|
||||
webContents.sendToAll = sendWrapper.bind(null, true)
|
||||
|
||||
// The navigation controller.
|
||||
controller = new NavigationController(webContents)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue