parent
0d799601d7
commit
9e254821bb
1 changed files with 13 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
# global-shortcut
|
# globalShortcut
|
||||||
|
|
||||||
The `global-shortcut` module can register/unregister a global keyboard shortcut
|
The `globalShortcut` 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.
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ app.on('will-quit', function() {
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
The `global-shortcut` module has the following methods:
|
The `globalShortcut` module has the following methods:
|
||||||
|
|
||||||
### `globalShortcut.register(accelerator, callback)`
|
### `globalShortcut.register(accelerator, callback)`
|
||||||
|
|
||||||
|
@ -46,17 +46,21 @@ The `global-shortcut` module has the following methods:
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
Registers a global shortcut of `accelerator`. The `callback` is called when
|
Registers a global shortcut of `accelerator`. The `callback` is called when
|
||||||
the registered shortcut is pressed by the user. Returns `true` if the shortcut
|
the registered shortcut is pressed by the user.
|
||||||
`accelerator` was registered, `false` otherwise. For example, the specified
|
|
||||||
`accelerator` has already been registered by another caller or other native
|
When the accelerator is already taken by other applications, this call will
|
||||||
applications.
|
silently fail. This behavior is intended by operating systems, since they don't
|
||||||
|
want applications to fight for global shortcuts.
|
||||||
|
|
||||||
### `globalShortcut.isRegistered(accelerator)`
|
### `globalShortcut.isRegistered(accelerator)`
|
||||||
|
|
||||||
* `accelerator` [Accelerator](accelerator.md)
|
* `accelerator` [Accelerator](accelerator.md)
|
||||||
|
|
||||||
Returns `true` or `false` depending on whether the shortcut `accelerator` is
|
Returns whether this application has registered `accelerator`.
|
||||||
registered.
|
|
||||||
|
When the accelerator is already taken by other applications, this call will
|
||||||
|
still return `false`. This behavior is intended by operating systems, since they
|
||||||
|
don't want applications to fight for global shortcuts.
|
||||||
|
|
||||||
### `globalShortcut.unregister(accelerator)`
|
### `globalShortcut.unregister(accelerator)`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue