internal export interface IDebounceContext { /**
     * aka this
     */ self : any ; args : any [ ] ; } param { ( ... args : any [ ] ) => void } callback param { number } timeToDelay param choose return { ( ... args : any [ ] ) => any } internal export default function debounce ( callback , timeToDelay = 100 , choose ? ) { let tm = - 1 ; let ctx = null ; return function ( this , ... args ) { if ( tm >= 0 ) { clearTimeout ( tm ) ; tm = - 1 ; } const next = { self : this , args } ; ctx = ctx && choose ? choose ( ctx , next ) : next ; tm = setTimeout ( ( ) => { console . assert ( ctx != null ) ; callback . apply ( ctx ! . self , ctx ! . args ) ; ctx = null ; } , timeToDelay ) as unknown as number ; } ; }