зеркало из https://github.com/electron/electron.git
Use "in" over "on"
This commit is contained in:
Родитель
bd264aa1ba
Коммит
b797804fd9
|
@ -53,7 +53,7 @@ server that you are requesting updates from. A common approach is to use query
|
|||
parameters, like this:
|
||||
|
||||
```javascript
|
||||
// On the main process
|
||||
// In the main process
|
||||
var app = require('app');
|
||||
var autoUpdater = require('auto-updater');
|
||||
autoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVersion());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# power-monitor
|
||||
|
||||
The `power-monitor` module is used to monitor power state changes. You can
|
||||
only use it on the main process. You should not use this module until the `ready`
|
||||
only use it in the main process. You should not use this module until the `ready`
|
||||
event of the `app` module is emitted.
|
||||
|
||||
For example:
|
||||
|
|
|
@ -5,13 +5,13 @@ Electron and third-party node modules also fully supported as well (including
|
|||
the [native modules](../tutorial/using-native-node-modules.md)).
|
||||
|
||||
Electron also provides some extra built-in modules for developing native
|
||||
desktop applications. Some modules are only available on the main process, some
|
||||
desktop applications. Some modules are only available in the main process, some
|
||||
are only available in the renderer process (web page), and some can be used in
|
||||
both processes.
|
||||
|
||||
The basic rule is: if a module is
|
||||
[GUI](https://en.wikipedia.org/wiki/Graphical_user_interface) or low-level
|
||||
system related, then it should be only available on the main process. You need
|
||||
system related, then it should be only available in the main process. You need
|
||||
to be familiar with the concept of
|
||||
[main process vs. renderer process](../tutorial/quick-start.md#the-main-process)
|
||||
scripts to be able to use those modules.
|
||||
|
|
|
@ -445,7 +445,7 @@ page can handle it by listening to the `channel` event of the `ipc` module.
|
|||
An example of sending messages from the main process to the renderer process:
|
||||
|
||||
```javascript
|
||||
// On the main process.
|
||||
// In the main process.
|
||||
var window = null;
|
||||
app.on('ready', function() {
|
||||
window = new BrowserWindow({width: 800, height: 600});
|
||||
|
@ -472,6 +472,6 @@ app.on('ready', function() {
|
|||
**Note:**
|
||||
|
||||
1. The IPC message handler in web pages does not have an `event` parameter,
|
||||
which is different from the handlers on the main process.
|
||||
which is different from the handlers in the main process.
|
||||
2. There is no way to send synchronous messages from the main process to a
|
||||
renderer process, because it would be very easy to cause dead locks.
|
||||
|
|
|
@ -25,6 +25,7 @@ These are the ways that we construct the Electron documentation.
|
|||
- Line length is 80-column wrapped.
|
||||
- Platform specific methods are noted in italics following method header.
|
||||
- ```### `method(foo, bar)` _OS X_```
|
||||
- Prefer 'in the ___ process' over 'on'
|
||||
|
||||
## Reading Electron Documentation
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче