Small edits
This commit is contained in:
parent
d02ced87b8
commit
dbc1855b42
3 changed files with 11 additions and 7 deletions
|
@ -4,7 +4,7 @@ The `global-shortcut` module can register/unregister a global keyboard shortcut
|
||||||
with the operating system so that you can customize the operations for various
|
with the operating system so that you can customize the operations for various
|
||||||
shortcuts.
|
shortcuts.
|
||||||
|
|
||||||
Note that the shortcut is global; it will work even if the app does
|
**Note**: The shortcut is global; it will work even if the app does
|
||||||
not have the keyboard focus. You should not use this module until the `ready`
|
not have the keyboard focus. You should not use this module until the `ready`
|
||||||
event of the app module is emitted.
|
event of the app module is emitted.
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ the registered shortcut is pressed by the user.
|
||||||
|
|
||||||
* `accelerator` [Accelerator](accelerator.md)
|
* `accelerator` [Accelerator](accelerator.md)
|
||||||
|
|
||||||
Returns `true` or `false` depending on whether the shortcut `accelerator` is registered.
|
Returns `true` or `false` depending on whether the shortcut `accelerator` is
|
||||||
|
registered.
|
||||||
|
|
||||||
### `globalShortcut.unregister(accelerator)`
|
### `globalShortcut.unregister(accelerator)`
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# ipc (main process)
|
# ipc (main process)
|
||||||
|
|
||||||
The `ipc` module, when used in the main process, handles asynchronous and synchronous messages sent from a renderer process (web page). Messages sent from a renderer will be emitted to this module.
|
The `ipc` module, when used in the main process, handles asynchronous and
|
||||||
|
synchronous messages sent from a renderer process (web page). Messages sent from
|
||||||
|
a renderer will be emitted to this module.
|
||||||
|
|
||||||
## Sending Messages
|
## Sending Messages
|
||||||
|
|
||||||
|
@ -10,7 +12,8 @@ for more information.
|
||||||
|
|
||||||
- When sending a message, the event name is the `channel`.
|
- When sending a message, the event name is the `channel`.
|
||||||
- To reply a synchronous message, you need to set `event.returnValue`.
|
- To reply a synchronous message, you need to set `event.returnValue`.
|
||||||
- To send an asynchronous back to the sender, you can use `event.sender.send(...)`.
|
- To send an asynchronous back to the sender, you can use
|
||||||
|
`event.sender.send(...)`.
|
||||||
|
|
||||||
An example of sending and handling messages between the render and main
|
An example of sending and handling messages between the render and main
|
||||||
processes:
|
processes:
|
||||||
|
@ -40,9 +43,9 @@ ipc.on('asynchronous-reply', function(arg) {
|
||||||
ipc.send('asynchronous-message', 'ping');
|
ipc.send('asynchronous-message', 'ping');
|
||||||
```
|
```
|
||||||
|
|
||||||
## Methods
|
## Listening for Messages
|
||||||
|
|
||||||
The `ipc` module has the following method:
|
The `ipc` module has the following method to listen for events:
|
||||||
|
|
||||||
### `ipc.on(channel, callback)`
|
### `ipc.on(channel, callback)`
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
The `ipc` module provides a few methods so you can send synchronous and
|
The `ipc` module provides a few methods so you can send synchronous and
|
||||||
asynchronous messages from the render process (web page) to the main process.
|
asynchronous messages from the render process (web page) to the main process.
|
||||||
You can also receive messages returned from the main process.
|
You can also receive replies from the main process.
|
||||||
|
|
||||||
**Note**: If you want to make use of modules in the main process from the renderer
|
**Note**: If you want to make use of modules in the main process from the renderer
|
||||||
process, you might consider using the [remote](remote.md) module.
|
process, you might consider using the [remote](remote.md) module.
|
||||||
|
|
Loading…
Add table
Reference in a new issue