-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to prevent keyboard long pressed? #16
Comments
Could you explain your use case in more details? Normally if you subscribe to |
@tomzx I'm try to count keystroke. gkm work fine but when I try long keypressed the number of couter increment so fast. |
You probably want to trigger the first time This way you can trigger an event on the initial const pressedKeys = {};
gkm.events.on('key.pressed', function(data) {
if (pressedKeys[data]) {
// Ignore
return;
}
pressedKeys[data] = true;
console.log(this.event + ' ' + data);
});
gkm.events.on('key.released', function(data) {
delete pressedKeys[data];
console.log(this.event + ' ' + data);
});
``` |
@tomzx That's work. Thanks! |
Is it possible to prevent that?
The text was updated successfully, but these errors were encountered: