Skip to content

useThrottleFnWithLock

useThrottleFnWithLock(fn, wait, options): useThrottleFnWithLockResult

使用节流函数和锁定函数实现带有锁定功能的函数。

参数

NameTypeDescription
fnFunction要执行的函数。
waitnumber节流等待的毫秒数,在该时间间隔内只会执行一次函数。
optionsany节流配置选项。

返回值

useThrottleFnWithLockResult

  • 一个包含运行函数、取消、立即执行和判断是否运行中的对象。

源码

use-throttle-fn-with-lock.js