jaywcjlove / hotkeys-js

➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
https://jaywcjlove.github.io/hotkeys-js
MIT License
6.66k stars 410 forks source link

Function to convert a KeyboardEvent to key string #377

Open NCC1701M opened 2 years ago

NCC1701M commented 2 years ago

The lib should support the function to convert a KeyboardEvent to a key string.

For example:

hotkeys("*", (evt, handler) => {
   console.log("You've pressed: " + handler.toKeyString());
  // Example output: You've pressed: ctrl+a+s
});
msimic commented 2 years ago

I added a similar issue many months ago, but there were no replies:

https://github.com/jaywcjlove/hotkeys/issues/360

User friendliness and customisation suffer because of lack of this feature.