hotkeys-js
hotkeys-js copied to clipboard
How to programmatically create a hotkey from the key the user has pressed?
I would like to offer the user a dialog to press a combination of keys and remember them as a hotkey shortcut for future use.
What I am looking for is something like this:
var pressedCodes = hotkeys.getPressedKeyCodes()
var newHotkey = convertCodesToHotkeyDefinition(pressedCodes)
hotkeys(newHotkey, function(){
// user used the shortcut he created
})
Obviously, I don't know how to generate the hotkey from the array of pressed codes (my convertCodesToHotkeyDefinition). Is there a function in hotkeys-js to do that or somebody knows how to do it?
Regards
No news here? Without this, the library is limited to only static shortcuts. No way to give the user the ability to assign their own shortcuts... (and no, having him fill a textbox with the string for the shortcut is not an option - not user friendly).