Add FAQ
This commit is contained in:
parent
5f0be5636a
commit
554bb69101
2 changed files with 90 additions and 0 deletions
|
@ -7,6 +7,13 @@ you can switch to a different version of the documentation at the
|
|||
you're using the GitHub interface, open the "Switch branches/tags" dropdown and
|
||||
select the tag that matches your version.
|
||||
|
||||
## FAQ
|
||||
|
||||
There are questions that are asked quite often, check this out before creating
|
||||
an issue:
|
||||
|
||||
* [Electron FAQ](faq/api-faq.md)
|
||||
|
||||
## Guides
|
||||
|
||||
* [Supported Platforms](tutorial/supported-platforms.md)
|
||||
|
|
83
docs/faq/electron-faq.md
Normal file
83
docs/faq/electron-faq.md
Normal file
|
@ -0,0 +1,83 @@
|
|||
# Electron FAQ
|
||||
|
||||
## When will Electron upgrade to latest Chrome?
|
||||
|
||||
The Chrome version of Electron is usually bumped within one or two weeks after
|
||||
a new stable Chrome version gets released.
|
||||
|
||||
Also we only use stable channel of Chrome, if an important fix is in beta or dev
|
||||
channel, we will back-port it.
|
||||
|
||||
## When will Electron upgrade to latest Node.js?
|
||||
|
||||
When a new version of Node.js gets released, we usually wait for about a month
|
||||
before upgrading the one in Electron. So we can avoid getting affected by bugs
|
||||
introduced in new Node.js versions, which happens very often.
|
||||
|
||||
New features of Node.js are usually brought by V8 upgrades, since Electron is
|
||||
using the V8 shipped by Chrome browser, the shiny new JavaScript feature of a
|
||||
new Node.js version is usually already in Electron.
|
||||
|
||||
## My app's window/tray disappeared after a few minutes.
|
||||
|
||||
This happens when the variable which is used to store the window/tray gets
|
||||
garbage collected.
|
||||
|
||||
It is recommended to have a reading of following articles you encountered this
|
||||
problem:
|
||||
|
||||
* [Memory Management][memory-management]
|
||||
* [Variable Scope][variable-scope]
|
||||
|
||||
If you want a quick fix, you can make the variables global by changing your
|
||||
code from this:
|
||||
|
||||
```javascript
|
||||
app.on('ready', function() {
|
||||
var tray = new Tray('/path/to/icon.png');
|
||||
})
|
||||
```
|
||||
|
||||
to this:
|
||||
|
||||
```javascript
|
||||
var tray = null;
|
||||
app.on('ready', function() {
|
||||
tray = new Tray('/path/to/icon.png');
|
||||
})
|
||||
```
|
||||
|
||||
## I can not use jQuery/RequireJS/Meteor/AngularJS in Electron.
|
||||
|
||||
Due to the Node.js integration of Electron, there are some extra symbols
|
||||
inserted into DOM, like `module`, `exports`, `require`. This causes troubles for
|
||||
some libraries since they want to insert the symbols with same names.
|
||||
|
||||
To solve this, you can turn off node integration in Electron:
|
||||
|
||||
```javascript
|
||||
// In the main process.
|
||||
var mainWindow = new BrowserWindow({
|
||||
webPreferences: {
|
||||
nodeIntegration: false
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
But if you want to keep the abilities of using Node.js and Electron APIs, you
|
||||
have to rename the symbols in the page before including other libraries:
|
||||
|
||||
```html
|
||||
<head>
|
||||
<script>
|
||||
window.nodeRequire = require;
|
||||
delete window.require;
|
||||
delete window.exports;
|
||||
delete window.module;
|
||||
</script>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
</head>
|
||||
```
|
||||
|
||||
[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
|
||||
[variable-scope]: https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx
|
Loading…
Reference in a new issue