onEvent rate of "fire"

When creating a onEvent listener for the keydown event, I was wondering how often does the event listener fire if you are holding down a key.

Also, does the rate of fire vary from computer to computer?

Thanks,
Bill

Yep, it’s going to vary computer to computer, and also will be affected by what else is happening in the app and probably other processes running on the computer as well. would make a fun little experiment.

1 Like

I thought I’d give it quick try. My code:
var x = 0;
onEvent(“screen1”, “keydown”, function( ) {
x = x+1;
});
timedLoop(1000, function() {
console.log("Key presses: "+x);
x = 0;
});

and the output:
Key presses: 0
Key presses: 8
Key presses: 34
Key presses: 34
Key presses: 34
Key presses: 34
Key presses: 33
Key presses: 34
Key presses: 34
Key presses: 29
Key presses: 0

1 Like