/** * 防抖,场景:搜索 * * 触发事件后在 n 秒内函数只能执行一次,如果 * 在 n 秒内又触发了事件,则会重新计算函数执行时间 * * @param {Function} fn 主函数 * @param {number} time 间隔时间,单位 `ms` * @param {boolean} immediate 是否立即执行,默认 `false` * @returns 闭包函数 * * @example * * ```ts * function count() { * console.log('xxxxx') * } * window.onscroll = debounce(count, 500) * * window.onscroll = debounce(count, 500, true) * ``` */ export declare function debounce(fn: Function, time: number, immediate?: boolean): (...args: Array) => any; /** * 不用生成中间函数的防抖 * * @example * ```ts * debounceRun(func, args, { * funcKey: 'funcKey', * wait: 500, // 默认 500 * throttle: false, // 是否是节流,默认 false * immediate: true, // 是否立即执行,默认 true * }) * `` */ export declare const debounceRun: (func: Function, args?: any[], options?: { funcKey?: any; wait?: number; throttle?: boolean; immediate?: boolean; debug?: boolean; }) => void;