3

I am looking to create a JavaScript app that relies heavily on keyboard shortcuts, is here a open-source library that answers those needs with cross-browser support and an easy Api?

David MZ
  • 3,648
  • 6
  • 33
  • 50

3 Answers3

4

KeyMaster

A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.

// define short of 'a'
key('a', function(){ alert('you pressed a!') });

// returning false stops the event and prevents default browser events
key('ctrl+r', function(){ alert('stopped reload!'); return false });

// multiple shortcuts that do the same thing
key('⌘+r, ctrl+r', function(){ });
epascarello
  • 204,599
  • 20
  • 195
  • 236
4

I recently wrote a library called mousetrap. Check it out at http://craig.is/killing/mice.

It is similar to keymaster, but also supports key sequences, international keyboard layouts, binding directly to special characters, specifying which event to listen for, etc.

It has no dependencies as well.

Craig
  • 2,684
  • 27
  • 20
1

Have a look at jquery.hotkeys and KeyboardJS.

Teun Zengerink
  • 4,277
  • 5
  • 30
  • 32