Is there a way to disable alert dialogs when errors occur in Electron App, or better yet disable ALL dialogs?
Dialogs are useless in headless mode (granted electron is not intended to be a headless app) and just get things stuck.
I'm not necessarily looking for a flag 'disable_dialogs'. Perhaps I could override one method in the main process so that dialogs don't open?
Is there a way to disable alert dialogs when errors occur in Electron App, or better yet disable ALL dialogs?
Dialogs are useless in headless mode (granted electron is not intended to be a headless app) and just get things stuck.
I'm not necessarily looking for a flag 'disable_dialogs'. Perhaps I could override one method in the main process so that dialogs don't open?
Share Improve this question asked Feb 25, 2016 at 7:18 LeMousselLeMoussel 5,77715 gold badges78 silver badges129 bronze badges 2- 1 discuss.atom.io/t/… – Adrian Lynch Commented Feb 25, 2016 at 7:20
- Yep, but no explanation on how to override the method to log to the console instead of the default behavior. – LeMoussel Commented Feb 26, 2016 at 7:34
1 Answer
Reset to default 5Someone has left the following on that discussion thread.
Disable error dialogs by overriding
const electron = require('electron');
const dialog = electron.dialog;
// Disable error dialogs by overriding
dialog.showErrorBox = function(title, content) {
console.log(`${title}\n${content}`);
};
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745650395a4638229.html
评论列表(0条)