admin管理员组文章数量:1026989
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}`);
};
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}`);
};
本文标签: javascriptHow to disable alert dialogs when errors occur in Atom ElectronStack Overflow
版权声明:本文标题:javascript - How to disable alert dialogs when errors occur in Atom Electron - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745650394a2161283.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论