let timeoutId ; const listener = ( e ) => { const target = e . target as HTMLElement ; if ( target . closest ( '#questions' ) && target . closest ( 'a' ) ) { e . preventDefault ( ) ; } } ; const timeoutCallback = ( ) => { window . removeEventListener ( 'click' , listener , true ) ; } ; export const temporarilyPreventClicks = ( ) => { window . addEventListener ( 'click' , listener , true ) ; window . clearTimeout ( timeoutId ) ; timeoutId = window . setTimeout ( timeoutCallback , 400 ) ; } ;