Skip to content

Delay #146

Description

@tifDev

Is it possible to increase the delay time of a combination?
I have longer combinations on my web app like 'a r c g' or 'a r c g k' and they take a bit time to think & press.

Activity

  1. dmauro commented on Dec 12, 2018

    @dmauro
    Owner

    Yup! Check out https://github.com/dmauro/Keypress/blob/development/keypress.coffee#L95, it's a little hidden but sequence_delay is a public property on the keypress.Listener which you can set (it's milliseconds).

  2. tifDev commented on Dec 13, 2018

    @tifDev
    Author

    It has no effect... i changed to 2000 miliseconds but i still need to type very fast for the combo to get count.
    See my small fiddle: https://jsfiddle.net/ombjs132/5/

    The code:

    
    var listener = new window.keypress.Listener();
    
    listener.sequence_delay = 2000;
    
    
    var my_scope = this;
    var my_combos = listener.register_many([
        {
            "keys"          : "r c g",
            "is_exclusive"  : true,
            "on_keyup"      : function(event) {
            console.log("You pressed r c g.");
                return true
            }
        },
        {
            "keys"          : "r c",
            "is_exclusive"  : true,
            "on_keyup"      : function(event) {
            console.log("You pressed r c.");
                return true
            }
        }
    ]);
    
  3. reopened this on Dec 13, 2018
  4. ContraTrouble commented on Dec 26, 2022

    @ContraTrouble

    I don't know what changed, but I found sequence_delay in the g property of the listener, so my code (which works) looks like this:

    if ('g' in keyListener && 'sequence_delay' in (keyListener as any)!.g) {
      (keyListener as any).g.sequence_delay = MaxSequenceTimeoutInMillis;
    } else  if ('sequence_delay' in keyListener) {
      // this one is just in case the "global" property starts working some day
      (keyListener as any).sequence_delay = MaxSequenceTimeoutInMillis;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions