Search code examples
javascripteventsdom-eventskeyevent

Capture undo, redo and other key events on different Operating systems in Javascript


Is there any library which can capture key events on any operating system and call the handler based on what action was performed?

For example, undo on Windows in cntrl+z, but on mac it is appleKey/commandkey + z.

So my question is is there any library that can call my undo handler on Windows as well as Mac?


Solution

  • Mousetrap seems like a pretty good start point. From there, you can detect the Apple key ('command') and different sequences and make your own custom aliases. Shouldn't be too difficult. :-)

    http://craig.is/killing/mice