How can I access the BrowserWindow JavaScript global from the main process in Electron?

Here is a reference to your comment about the webContents process in the API, in the “Note:” under remotes. However, if you just want to trigger a function, you could also use the webContents.send() and ipc(main process) processes to trigger the appropriate code to run. Something like this… // JavaScript inside the main process const … Read more

How to debug electron production binaries

Here’s what worked for me on Mac. In terminal type lldb path/to/build.app In the opened debugger type run –remote-debugging-port=8315. It should open a window of your app. Open Chrome at http://localhost:8315/ Click on the name of the app. For example, Webpack App. If you don’t see anything in the opened tab, focus on the window … Read more

How do I reload a page with react-router?

firstly, add react-router as a dependency yarn add react-router or npm install react-router Then (for react-router v5) import { useHistory } from ‘react-router’ const history = useHistory() // then add this to the function that is called for re-rendering history.go(0) This causes your page to re-render automatically For react-router v6 use the useNavigate hook instead: … Read more

electron package: reduce the package size

You can reduce the electron app size by packaging using electron-builder package. PicArt is an electronjs app which I developed recently. It is built using reactJS. Initially when I packaged the app using electron-packager the Window’s build size was around 98 MB. Then I found this awesome boilerplate electron-react where they configured the electron-builder to … Read more

Distinction between the renderer and main processes in Electron

The main/renderer process distinction isn’t actually an Electron concept per se — it’s inherited from Chromium (here’s an article on Chromium’s architecture and the reasoning behind it). This is the architecture that Chrome uses for performance and stability reasons. Each webContents instance runs in it’s own process (a “renderer” process). The main process (there can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)