Comments (2)
At current there is no "easy" way to do mass key bindings, other than using jwerty.is.
I have been considering the issue of mass-keybindings though, before this issue. My proposal is to allow an object mapping of keys to functions, allowing you to do something like this:
jwerty.key('myinput', {
'ctrl+shift+a': false,
'ctrl+shift+x': function () { console.log('ctrl shift x'); },
'ctrl+shift+p': myFunction
});
However for repetitive tasks, that mostly do the same thing with a few minor exceptions, this doesn't really improve anything.
I'd like to see your use code though, how you're using it and what you think would improve the terseness.
from jwerty.
HI Keith,
Thanks for the answer. While posting the issue, I thought that maybe I was not doing things optimally.
I'm doing a webapp, in which I use key combos (and for this, jwerty just rocks), but also single keypresses. I don't feel comfortable at adding my own keydown events, so I had to do it to detect single dead keys, as posted in another issue (how, with jwerty, would you use a dead key to enable a specific mode of your app? Like: normal mouse action is drawing, but if I press Ctrl, same mouse action will result in moving elements? I need a keydown and a keyup callbacks, and as of now, had to do with my own (crappy) code. Though this is another issue, it also comes to the fact I need to "complete" Jwerty, which is a bit less elegant for me.
As for the current issue, here's my need: I use the same callback for two keys (v and h namely), and use the key as an object property, to make it simple.
I have something like:
Jwerty.key('v/h', myCallback);
function myCallback(e) {
var key=Key.getKey(e);
MyObject[key] = "foobar";
}
from jwerty.
Related Issues (20)
- Keyboard shortcut to launch modal window... HOT 2
- Bugs with some symbols (OSX) HOT 2
- Typo on the website
- ctrl+n binding? HOT 1
- Need for an ability to detect if ctrl/shift/alt key is active at current event HOT 3
- Unbind key will not work
- IE 8 issue when binding to enter key in textboxes HOT 2
- Key combo triggers on single key. HOT 1
- Rm canBridge.js
- Firing actually doesn't do anything in latest Chrome?
- Comparison with established keyboard libraries HOT 1
- Minus (-) key doesn't work HOT 2
- Unbinding should be internalized HOT 6
- Please push latest version to npm
- jwerty.key(...) returns nothing
- cmd+l not working in Safari
- get actual keys pressed when matching regex or optional HOT 1
- document using + sign HOT 4
- Difference between source code and archives/npmjs versions HOT 2
- Unbind doesn't work. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwerty.