Skip to content
On this page

Home > @taiyuuki/utils > throttle

throttle() function

为给定函数实现节流功能。

Signature:

typescript
declare function throttle<T extends Fn>(func: T, timeFrame: number, immediately?: boolean): T;
declare function throttle<T extends Fn>(func: T, timeFrame: number, immediately?: boolean): T;

Parameters

ParameterTypeDescription
funcT需要节流的函数
timeFramenumber时间间隔
immediatelyboolean(Optional) 是否立即执行,默认值为 true

Returns:

T

节流后的函数

Released under the MIT License.