import { ThrottleFunction } from './types' ; param fn param throttleTimeMs returns public export const throttle = < Params extends any [ ] > ( fn , throttleTimeMs ) : ThrottleFunction < Params > => { let timeout ; let params ; const throttleFn = ( ... args ) => { params = args ; if ( ! timeout ) { timeout = setTimeout ( ( ) => { fn ( ... params ) ; timeout = undefined ; } , throttleTimeMs ) ; } } ; return throttleFn ; } ;