Ensure the callback is a function when executing JS
This commit is contained in:
parent
f549bda9fc
commit
095e79b043
1 changed files with 1 additions and 1 deletions
|
@ -115,8 +115,8 @@ const asyncWebFrameMethods = function (requestId, method, callback, ...args) {
|
||||||
this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
|
this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
|
||||||
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, error, result) {
|
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, error, result) {
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
if (callback != null) callback(result)
|
|
||||||
resolve(result)
|
resolve(result)
|
||||||
|
if (typeof callback === 'function') callback(result)
|
||||||
} else {
|
} else {
|
||||||
reject(error)
|
reject(error)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue