feat: make ipc-message
and ipc-message-sync
events public (#16468)
This commit is contained in:
parent
dbc5f67dca
commit
6cba2c50a2
7 changed files with 82 additions and 26 deletions
|
@ -342,17 +342,19 @@ WebContents.prototype._init = function () {
|
|||
this.capturePage = deprecate.promisify(this.capturePage, 2)
|
||||
|
||||
// Dispatch IPC messages to the ipc module.
|
||||
this.on('ipc-message', function (event, [channel, ...args]) {
|
||||
this.on('-ipc-message', function (event, [channel, ...args]) {
|
||||
this.emit('ipc-message', event, channel, ...args)
|
||||
ipcMain.emit(channel, event, ...args)
|
||||
})
|
||||
|
||||
this.on('ipc-message-sync', function (event, [channel, ...args]) {
|
||||
this.on('-ipc-message-sync', function (event, [channel, ...args]) {
|
||||
Object.defineProperty(event, 'returnValue', {
|
||||
set: function (value) {
|
||||
return event.sendReply([value])
|
||||
},
|
||||
get: function () {}
|
||||
})
|
||||
this.emit('ipc-message-sync', event, channel, ...args)
|
||||
ipcMain.emit(channel, event, ...args)
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue