

Keypress: A JavaScript input capture library - dmauro
http://dmauro.github.com/Keypress/

======
federicoweber
Another javascript library to handle keyboard combos is Mousetrap. Compared to
the latter I like the way Keypress handle multiple combos declaration, but
overall mousetrap seems more robust.

Also it's not clear to me how Keypress differentiate (if it does so) among a
sequence of keys or a combinations. Mousetrap is using the + notation to
handle that so you can declare different bindings for combinations
'command+shift+k' and sequences 'command shift k'.

<https://github.com/ccampbell/mousetrap>

~~~
dmauro
I haven't dug into Mousetrap, but I made Keypress because I needed/wanted the
arbitrary modifiers and counting combos features which mousetrap does not have
(and also Mousetrap hadn't been released yet when I started work on this).
Keypress also gives you a lot of control with the explicit options like
is_exclusive, prevent_default, prevent_repeat, and is_ordered. The
prevent_default option for instance will prevent the default behavior on all
keys that are part of a combo if it thinks you are working towards a combo
(for instance, when pressing up + right, both keys events will have
preventDefault applied).

As I mentioned, I didn't actually try using Mousetrap, but from looking at the
documentation Keypress should have at least the same features and then some
more very specific features that are probably only useful for games.

------
Keithamus
There seems to be a new one of these each week. Here's my attempt from around
a year ago: <http://keithcirkel.co.uk/jwerty/>

------
J0415
Great work just wanted to say that Print screen button was not working for me.
Running Chrome 22.0.1229.79 on Windows 7.

~~~
dmauro
Thanks :)

I made a note of some special case keys towards the bottom of the
documentation. Some keys have flaky browser support (either keyup and/or
keydown don't fire properly) so I call them out so they can be avoided and
'print' is one of them.

