What does 'flush event' does in context of wait command?

Just as title said. What does it do?

It flushes the user events, meaning after such a wait, you are ensured there are no more user events in the queue that you could catch. Rarely used in practice except if you want to ‘reset’ the user events in a way or another (typically with a very small specified delay, as wait -1).