https://github.com/mixmaxhq/electron-accelerator-formatter
Formats an Electron accelerator as a string of Unicode characters
https://github.com/mixmaxhq/electron-accelerator-formatter
unsupported
Last synced: 18 days ago
JSON representation
Formats an Electron accelerator as a string of Unicode characters
- Host: GitHub
- URL: https://github.com/mixmaxhq/electron-accelerator-formatter
- Owner: mixmaxhq
- License: mit
- Created: 2015-12-15T01:58:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-09T20:18:18.000Z (almost 2 years ago)
- Last Synced: 2024-10-22T00:28:25.211Z (7 months ago)
- Topics: unsupported
- Language: JavaScript
- Size: 66.4 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-accelerator-formatter
Formats an [accelerator](https://github.com/atom/electron/blob/master/docs/api/accelerator.md)
as a string of Unicode characters.Handles Windows and Mac, not yet Linux.
Works in both Electron (i.e. Node) and the browser!
## Installation
For Electron:
```js
npm install electron-accelerator-formatter
```
or
```js
npm install electron-accelerator-formatter --save
```For the browser:
```js
bower install electron-accelerator-formatter --save
```## Usage
In Electron:
```js
var acceleratorFormatter = require('electron-accelerator-formatter');var accelerator = 'CmdOrCtrl+Shift+M';
// Prints '⌘⇧M' on Mac, '^⇧M' on Windows
console.log(acceleratorFormatter(accelerator));
```In the browser:
```html
var accelerator = 'CmdOrCtrl+Shift+M';
// Prints '⌘⇧M' on Mac, '^⇧M' on Windows
console.log(electronAcceleratorFormatter(accelerator));```
*Warning*: there is also a minified version available, `dist/bundle.min.js`, but if you want to use
that make sure that you are sending the UTF-8 HTTP header from your server or have added ``
to the page, or the formatter output will be garbled: https://github.com/webpack/webpack/issues/1035.## Contributing
We welcome pull requests! Please lint your code.
### Running tests
To run the Node tests: `npm test`.
To run the browser tests: `npm run-script build-test && npm run-script open-test`.
### Building for release
`npm run-script build`
## Release History
* 1.1.1 Add bower.json file
* 1.1.0 Works in the browser!
* 1.0.1 Documentation fix
* 1.0.0 Initial release.