最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to disable alert dialogs when errors occur in Atom Electron - Stack Overflow

programmeradmin2浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 5

Someone 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}`);
};
发布评论

评论列表(0)

  1. 暂无评论