feat: allow registering multiple shortcuts (#15542)

This PR allows for multiple global shortcuts to be registered such that triggering any of them calls the same callback.
This commit is contained in:
Shelley Vohr 2018-11-07 09:40:38 -08:00 committed by GitHub
parent 20a540e680
commit e9ba26f50e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 2 deletions

View file

@ -54,6 +54,17 @@ When the accelerator is already taken by other applications, this call will
silently fail. This behavior is intended by operating systems, since they don't
want applications to fight for global shortcuts.
### `globalShortcut.registerAll(accelerators, callback)`
* `accelerators` String[] - an array of [Accelerator](accelerator.md)s.
* `callback` Function
Registers a global shortcut of all `accelerator` items in `accelerators`. The `callback` is called when any of the registered shortcuts are pressed by the user.
When a given accelerator is already taken by other applications, this call will
silently fail. This behavior is intended by operating systems, since they don't
want applications to fight for global shortcuts.
### `globalShortcut.isRegistered(accelerator)`
* `accelerator` [Accelerator](accelerator.md)