I have a Javascript code that executes a function every time a button is pressed, however, my hardware setup is occasionally sending double inputs (ie pressing the button twice) – when this happens, they are a sheer milliseconds apart. is it possible to restrict the javascript from executing the function twice within say 50ms of time?
Share
Yes, you have to keep track of the last time you ran the function. Something like: