Option to run custom code inside main.js #655

Closed
opened 2026-01-29 16:45:16 +00:00 by claunia · 3 comments
Owner

Originally created by @lukasportal on GitHub (Apr 26, 2021).

Originally assigned to: @GregorBiswanger on GitHub.

Today we don't have access to main.js which is the entry point for the electron app and where it starts the asp.net executable.
It would be great if we had a way to maybe specify a path to a js file in the manifest where will be executed inside the main.js file.

The main reason for this is that I need to disable error dialogs so it won't stop the execution.

The code to disable the error dialogs is this:

const electron = require('electron');
const dialog = electron.dialog;

// Disable error dialogs by overriding
dialog.showErrorBox = function(title, content) {
    console.log(`${title}\n${content}`);
};

I need to have access to the electron.dialog but this is only available from the main.js file and not from the proxy where it'll only be available as electron.remote.dialog which is useless for this.

Originally created by @lukasportal on GitHub (Apr 26, 2021). Originally assigned to: @GregorBiswanger on GitHub. Today we don't have access to main.js which is the entry point for the electron app and where it starts the asp.net executable. It would be great if we had a way to maybe specify a path to a js file in the manifest where will be executed inside the main.js file. The main reason for this is that I need to disable error dialogs so it won't stop the execution. The code to disable the error dialogs is this: ``` const electron = require('electron'); const dialog = electron.dialog; // Disable error dialogs by overriding dialog.showErrorBox = function(title, content) { console.log(`${title}\n${content}`); }; ``` I need to have access to the electron.dialog but this is only available from the main.js file and not from the proxy where it'll only be available as electron.remote.dialog which is useless for this.
claunia added the Feature label 2026-01-29 16:45:16 +00:00
Author
Owner

@lukasportal commented on GitHub (May 2, 2021):

or maybe just a feature to disable error box and console.error/log instead?
do you know of any workaround to have this possible right now?

@lukasportal commented on GitHub (May 2, 2021): or maybe just a feature to disable error box and console.error/log instead? do you know of any workaround to have this possible right now?
Author
Owner

@ppostman commented on GitHub (Oct 29, 2021):

@lukasportal did you find a solution to this?

@ppostman commented on GitHub (Oct 29, 2021): @lukasportal did you find a solution to this?
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#655