/** * 根据目前处理执行状态的函数调用次数对函数进行节流处理,当目前处于执行状态的函数调用数已达限制,则不再执行函数, * 直到有函数调用执行完成使得目前处于执行状态的函数调用数降低到限制以下时,才能够执行函数。 * * @param {(...args: any[]) => Promise} fun 要进行节流处理的函数,该函数必须返回 Promise * @param {string} tag 目前处于执行状态的调用次数标记名称,默认为'_throttle' * @param {number} limit 同时处理执行状态的函数调用次数限制,默认为 1 * @param {any} thisArg 指定需要节流处理的函数(传统函数)调用时的 this 指向,默认为 null,即非严格模式下函数调用时的 this 指向全 * 局对象,严格模式下为 thisArg 指定的值;对于需要节流处理的函数为箭头函数时,该参数无效,箭头函数的 this 指向由函数定义时确定,不受 * thisArg 参数影响,箭头函数的 this 来源于箭头函数定义时的上级作用域。 * @returns {(...args: any[]) => Promise} 节流处理后的函数 */ export declare const funThrottleByLimit: ({ fun, tag, limit, thisArg, }: { fun: (...args: any[]) => Promise; tag?: string; limit?: number; thisArg?: any; }) => (...args: any[]) => Promise; /** * 根据调用函数的时间间隔对函数进行节流处理,当目前调用函数的时间距离上次函数调用时间的间隔小于指定间隔,则不执行函数的调用,直到函数调用 * 的时间与上次函数调用时间的间隔大于或等于指定间隔时,才执行函数的调用。 * * @param {(...args: any[]) => Promise} fun 要进行节流处理的函数,该函数必须返回 Promise * @param {number} interval 相邻两次函数调用的时间间隔,单位为 ms,默认为 500ms * @param {any} thisArg 指定需要节流处理的函数(传统函数)调用时的 this 指向,默认为 null,即非严格模式下函数调用时的 this 指向全 * 局对象,严格模式下为 thisArg 指定的值;对于需要节流处理的函数为箭头函数时,该参数无效,箭头函数的 this 指向由函数定义时确定,不受 * thisArg 参数影响,箭头函数的 this 来源于箭头函数定义时的上级作用域。 * @returns {(...args: any[]) => Promise} 节流处理后的函数 */ export declare const funThrottleByTime: ({ fun, interval, thisArg, }: { fun: (...args: any[]) => Promise; interval?: number; thisArg?: any; }) => (...args: any[]) => Promise;