Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blahah/choo-kanye
kanye (w)rapper for choo - easily add keyboard shortcuts to your choo app :steam_locomotive::train::train: + :train::notes::microphone:
https://github.com/blahah/choo-kanye
Last synced: 6 days ago
JSON representation
kanye (w)rapper for choo - easily add keyboard shortcuts to your choo app :steam_locomotive::train::train: + :train::notes::microphone:
- Host: GitHub
- URL: https://github.com/blahah/choo-kanye
- Owner: blahah
- License: cc0-1.0
- Created: 2017-07-02T22:01:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-02T23:22:40.000Z (over 7 years ago)
- Last Synced: 2024-10-31T04:34:52.726Z (13 days ago)
- Language: JavaScript
- Homepage:
- Size: 357 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
---
## Install
```
npm install --save choo-kanye
```## Usage
### API
This module implements the [`kanye` API](https://github.com/bevacqua/kanye) using `choo` events.
Any `kanye` events received before the DOM is loaded are buffered until they can be registered.
Events `choo-kanye` listens to:
- `kanye:on` args: `combo, options?, listener`
- see ['kanye.on'](https://github.com/bevacqua/kanye#kanyeoncombo-options-listener)
- `kanye:off` args: `combo, options?, listener`
- see ['kanye.off'](https://github.com/bevacqua/kanye#kanyeoffcombo-options-listener)
- `kanye.clear` args: `context?`
- see ['kanye.clear'](https://github.com/bevacqua/kanye#kanyeclearcontext)### Example
``` js
var app = require('choo')choo.use(require('choo-kanye'))
choo.use(function(state, bus) {
var sayhi = function () {
console.log('hi!')
}
// run sayhi when the user presses ctrl+shift+a while element with id 'main' is the target
bus.emit('kanye:on', 'ctrl+shift+a', { filter: '#main' }, sayhi)
})
```## License
To the extent possible by law, we transfer any rights we have in this code to the public domain. Specifically, we do so using the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).
You can do whatever you want with this code. No need to credit us, link to us, include any license, or anything else. But if you want to do those things, you're free to do that too.