This is an action indicating that someone is heated with great passion, for example, when they are shocked, raged, amazed, inspired, etc. Earlier, the famous book series by Ling Mengchu 凌濛初 (1580-1644) titled Chuke pai’an jingqi 初刻拍案驚奇 [Slapping the Table in Amazement I] and Er’ke pai’an jingqi 二刻拍案驚奇 [Slapping the Table in Amazement II] use this phrase to indicate how amazing their stories are.