How to block tap/touch events for a period of time (during animations etc)?


I’m almost finished with my fairly big app, and now I’m testing it. In one part of the GUI it swaps between screens/views with a cool zooming animation when tapping a button. The app runs a bit slow on slow phones, but is perfectly usable. However when monkey-testing (tapping aggressively and fast) on slower phones I get issues with that taps get registered on the next screen before animation is complete and the layout can break in mysterious ways. This never happens on faster phones/devices or if I sit nicely and wait for the app to complete its animations.

A simple work-around would be to block all tap/touch events for a period of time. Is that possible to do?

I mean something like
setTimeout(unblockEvents, 400);