You can use my KeyboardJS library. It has a method called .getActiveKeys () that tells you which keys are active. The library is really tied to keys and key combos in the usual sense.
I would suggest using event binding.
KeyboardJS.bind.key('shift', function(){
Note that you can do complex things like shift + z + x or z + x + c. This works if the shift, z, x are compressed together, or z, x, c are compressed together.
KeyboardJS.bind.key('shift + z + x, z + x + c', function(){
You can read which keys are pressed outside the event callback, such as
var activeKeys = KeyboardJS.getActiveKeys();
Hope this helps, Hooray!
source share