Link Accelerator docs to globalShortcut module

Usage of Accelerators (i.e. `globalShortcut.register`) is now documented in the Accelerator docs themselves.
This commit is contained in:
Will Tange 2016-10-26 14:48:09 +02:00 committed by GitHub
parent eed8f201e2
commit aeb774730b

View file

@ -2,14 +2,30 @@
> Define keyboard shortcuts.
Accelerators can contain multiple modifiers and key codes, combined by
the `+` character.
Accelerators are Strings that can contain multiple modifiers and key codes,
combined by the `+` character, and are used to define keyboard shortcuts
throughout your application.
Examples:
* `CommandOrControl+A`
* `CommandOrControl+Shift+Z`
Shortcuts are registered with the [`globalShortcut`](global-shortcut.md) module
using the [`register`](global-shortcut.md#globalshortcutregisteraccelerator-callback)
method, i.e.
```javascript
const {app, globalShortcut} = require('electron')
app.on('ready', () => {
// Register a 'CommandOrControl+Y' shortcut listener.
globalShortcut.register('CommandOrControl+Y', () => {
// Do stuff when Y and either Command/Control is pressed.
})
})
```
## Platform notice
On Linux and Windows, the `Command` key does not have any effect so