1.0.2 • Published 4 years ago

@lllllxt/throttle v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

throttle

节流函数,懂的都懂

安装

npm i @lllllxt/throttle

使用

throttle(fn:, [wait=500], [option])

参数类型/默认描述
fnfunction要节流的函数
waitnumber,500需要节流的毫秒数
optionobject, {}选项
option.leadingboolean,true是否在节流开始前调用
option.trailingboolean,true是否在节流结束后调用

参数和 Loadsh.throttle 的完全一样, 但是自我感觉我实现得好一点 :joy:

也不知道是不是我得问题, 在使用 Loadsh.throttle ( v4.17.15 ) 时 leading , trailing 同时 false 时调用 fn 的时间间隔并不是 wait 所设定的时间

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago