I'm working with the package robot.js and need to run lots of key tap commands (often over 50 a second) with my program.
So far it goes a bit like this:
...for in elements
setTimeout(() => {
console.log(element.deltaTime) // Logs the time that the key should be pressed at (in ms)
if(shifted(element.key)){
robot.keyTap(element.key,"shift")
}else{
robot.keyTap(element.key)
}
}, element.deltaTime);
That's not the exact program here because it would take too long to explain, but it gets most of the problem. Basically, I'm trying to run lots of key taps in a short amount of time.
The problem here is that robot.js takes its sweet time hitting the keys, and delays the execution of other keys until it's finished, leaving a really slow result. Commenting out the robot.keyTap() function runs the program much faster, but you know, doesn't tap the keys.
Any help is appreciated, I really want to get this working fast.