hotkeys-js icon indicating copy to clipboard operation
hotkeys-js copied to clipboard

Is it possible to have hotkeys as sequence of same key (example: /+g+g)?

Open milanchheda opened this issue 2 years ago • 2 comments

Hi there,

First of all, thank you for the amazing JS library.

As mentioned above, is it possible to have same key sequentially being pressed as the hotkey?

This would be something like pressing gg inside a Github repository takes you to a Discussion tab.

Also, if we already have lets say /+g as one of the hotkeys, can we have another hotkey as /+g+g?

I tried below but it always picks up /+g. I even changed the sequence of case in the below code but still /+g only gets triggered:

k('/+g,/+g+g', function (event, handler) {
    event.preventDefault();
   switch (handler.key) {
      case '/+g':
         // some code goes here.. 
      break;

      case '/+g+g':
         // some code goes here for /+g+g.. 
      break;
   }
});

Any advice / suggestion would be of great help. Thanks.

milanchheda avatar Aug 26 '21 09:08 milanchheda

I guess not :(

thenitai avatar Jan 11 '22 22:01 thenitai