import * as React from 'react' ; const DEFAULT_DELAY = 250 ; function doubleClickListener < T extends any > ( onClick , onDblClick , delay = DEFAULT_DELAY ) { let timeout = null ; return ( event ) : void => { if ( ! timeout ) { timeout = setTimeout ( ( ) => { onClick ( event ) ; timeout = null ; } , delay ) ; } else { clearTimeout ( timeout ) ; timeout = null ; onDblClick ( event ) ; } } ; } export default doubleClickListener ;