function _debounce ( method , time = 500 ) { let timer = null ; return function ( ) { const context = this ; const args = arguments ; clearTimeout ( timer ) ; timer = setTimeout ( function ( ) { method . apply ( context , args ) ; } , time ) ; } as typeof method ; } function _cloneDeep < T > ( value ) { if ( ! value ) return value ; return JSON . parse ( JSON . stringify ( value ) ) ; } export const throttle = function ( func , delay ) { let timer = null ; let startTime = Date . now ( ) ; return function ( ) { const curTime = Date . now ( ) ; const remaining = delay - ( curTime - startTime ) ; const context = this ; const args = arguments ; clearTimeout ( timer ) ; if ( remaining <= 0 ) { func . apply ( context , args ) ; startTime = Date . now ( ) ; } else { timer = setTimeout ( ( ) => { func . apply ( context , args ) ; } , remaining ) ; } } ; } ; export const cloneDeep = _cloneDeep ; export const debounce = _debounce ; export default { cloneDeep , debounce , throttle , } ;