refactor: replace ipcRendererUtils.invoke() with ipcRendererInternal.invoke() (#19574)

This commit is contained in:
Milan Burda 2019-08-24 00:45:50 +02:00 committed by Jeremy Apthorp
parent 698120daf0
commit 81e9dab52f
29 changed files with 195 additions and 164 deletions

View file

@ -21,11 +21,12 @@ ipcRenderer.sendTo = function (webContentsId, channel, ...args) {
return ipc.sendTo(internal, false, 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
})
ipcRenderer.invoke = async function (channel, ...args) {
const { error, result } = await ipc.invoke(internal, channel, args)
if (error) {
throw new Error(`Error invoking remote method '${channel}': ${error}`)
}
return result
}
export default ipcRenderer