/** * @description 函数防抖 * @param { Function } fn 需要防抖的函数 * @param { Number } t 防抖时间,多久以后才能再执行 单位ms * @param { Boolean } immediate true: 立刻执行方法且最后一次时间不执行, false: 等t时间之后再执行方法,如果t时间内执行,则在最后一次的t时间之后执行方法,类似动态搜索效果 * @example * // 在鼠标resize的过程中,1秒以后可以被执行,如果在1秒内触发resize,则从新计算下一个一秒再允许执行 * window.onresize = debounce(function () { * // es5 获取参数 * let arg = Array.prototype.slice.call(arguments) * // es6 获取参数 * let arg1 = Array.from(arguments) * console.log('resize-debounce', arg) * console.log('resize-debounce', arg1) * }, 1000) */ export declare function debounce(fn: Function, t: number, immediate?: boolean): any; export default debounce;