Make executeJavaScript return a Promise so that caught errors can be sent to the caller
This commit is contained in:
parent
75b010ce63
commit
857e1da6a3
5 changed files with 59 additions and 7 deletions
|
@ -173,6 +173,10 @@ app.on('ready', function () {
|
|||
if (hasCallback) {
|
||||
window.webContents.executeJavaScript(code, (result) => {
|
||||
window.webContents.send('executeJavaScript-response', result)
|
||||
}).then((result) => {
|
||||
window.webContents.send('executeJavaScript-promise-response', result)
|
||||
}).catch((err) => {
|
||||
window.webContents.send('executeJavaScript-promise-error', err)
|
||||
})
|
||||
} else {
|
||||
window.webContents.executeJavaScript(code)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue