/**
 * Throttling function.
 */ export const throttle = < P , T extends ( ... args : any [ ] ) => P > ( f , time ) => { let isLocked = false ; return ( ... args ) => { if ( ! isLocked ) { f ( ... args ) ; setTimeout ( ( ) => isLocked = false , time ) ; } } ; } ;