Skip to content
Advertisement

Tag: electron

Replacing JS require(‘…’) with ESM imports

After updating node-fetch to v3, the following JavaScript error message appears when trying to launch my Electron app: Uncaught Exception: Error [ERR_REQUIRE_ESM]: require() of ES Module (…) not supported. Instead change the required … to a dynamic import() … I have found here that I should replace with: But how to replace in the same fashion the following? Answer Typically,

document.getElementById(“myFile”).value gets undefined using electron

I have a very basic html file (using electron); and an event listener named render.js; But when I click submit, document.getElementById(“myFile”).value returns undefined how can I pull that value? Answer This is an interesting issue that confronts many people using Electron. One could either use (via Electron) the native OS dialog.showOpenDialog([browserWindow, ]options) dialog or the html <input type=”file”> tag. To

Sending message from Main to Renderer

Could someone help me out here. I’m completely confused on how to solve this. I’ve now spent about a week trying to find a solution for this but have come up short and there appears to be a lack of a solid solution online. I’ve made a github repository trying to demonstrate the issue. In short I’ve implemented a status

Electron “ready-to-show” event not working as expected

Here is a block of code from my application Codey. src/main.py src/docs/renderer.js When darkMode = true, toggleDarkMode is never run. My application has two different windows – an editor and a docs window. For both windows, on the “ready-to-show” event, “dark-mode:toggle” is sent to the renderer process. However, the docs window fails to run the toggleDarkMode function whilst it works

Advertisement