Use ES6 template strings, fix docs and remove _ERROR_ IPC event
This commit is contained in:
parent
857e1da6a3
commit
9f18a6e65c
4 changed files with 10 additions and 12 deletions
|
@ -112,12 +112,10 @@ const webFrameMethodsWithResult = [
|
|||
const asyncWebFrameMethods = function (requestId, method, callback, ...args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
|
||||
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, result) {
|
||||
if (callback) callback(result)
|
||||
resolve(result)
|
||||
})
|
||||
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_ERROR_${requestId}`, (event, error) => {
|
||||
reject(error)
|
||||
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, error, result) {
|
||||
if (callback && !error) callback(result)
|
||||
if (error) return reject(error)
|
||||
return resolve(result)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue