Answer the question
In order to leave comments, you need to log in
What are variable scopes in Electron?
1. You can transfer variables from main.js to index.html ... in general, how to get access to the main js file from loaded ones, for example, pass an event.
2. Is there some kind of variable area in electron where variables will be saved during reboot?
Answer the question
In order to leave comments, you need to log in
You can get a global variable in the renderer process like this:
In the main process (main.js): global.something = value;
In the renderer process (index.html):
const remote = require('electron').remote;
var something = remote.getGlobal('something');
practically did not work with electron, but studied it.
they have separate scopes, so for data transfer it is necessary to use special designed events.
see details
https://github.com/atom/electron/blob/master/docs/...
https://github.com/atom/electron/blob/master/docs/...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question