export function simpleDebounce < T extends Function > ( fn ) { let executing = false ; let pendingExecution = null ; return ( async ( ... args ) => { if ( executing ) { pendingExecution = args ; return null as any ; } executing = true ; await fn ( ... args ) . catch ( ( e ) => console . error ( e ) ) ; if ( pendingExecution ) { await fn ( ... args ) . catch ( ( e ) => console . error ( e ) ) ; pendingExecution = null ; } executing = false ; } ) as any ; }