Ask the "click" handler to add the class ("clicking", possibly) to the button, and also start the timer to delete the class after 2 seconds. If the handler sees that the “click” is already applied to the button, it does nothing.
You can also disable the button; this might be better as it will give the user a visual indication that the button will do nothing.
source share