feat: add ipcRenderer.invoke() (#18449)
This commit is contained in:
parent
b180fb376c
commit
c436997840
17 changed files with 389 additions and 20 deletions
|
@ -27,4 +27,11 @@ ipcRenderer.sendToAll = function (webContentsId, channel, ...args) {
|
|||
return ipc.sendTo(internal, true, webContentsId, channel, args)
|
||||
}
|
||||
|
||||
ipcRenderer.invoke = function (channel, ...args) {
|
||||
return ipc.invoke(channel, args).then(({ error, result }) => {
|
||||
if (error) { throw new Error(`Error invoking remote method '${channel}': ${error}`) }
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = ipcRenderer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue