UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

19 lines (18 loc) 413 B
/** * 节流 * * 连续触发事件但是在 n 秒中只执行一次函数 * @param {Function} fn 主函数 * @param {number} time 间隔时间,单位 `ms` * @returns 闭包函数 * * @example * * ```ts * function count() { * console.log('xxxxx') * } * window.onscroll = throttle(count, 500) * ``` */ export declare function throttle(fn: Function, time: number): (...args: Array<any>) => void;