hooks
hooks copied to clipboard
feature: The throttle function should remove the default 1000 milliseconds to support the use of requestAnimationFrame
Hello, I have a requirement in my React project to throttle using requestAnimationFrame. I noticed that lodash natively supports it, but ahooks has added extra logic to set a default time of 1000 milliseconds. Here are the links to the two relevant source code sections:
你可以把 wait 设置为 0 来实现你的需求
https://github.com/lodash/lodash/blob/main/src/debounce.ts#L77-L78
@crazylxr 见哥,这里 wait 设置 0 恰好是绕过 requestAnimationFrame,需要 ahooks 支持用户设置 wait 为 undefined 来启用 requestAnimationFrame 的,你再看下呢~
solved: https://github.com/alibaba/hooks/pull/2332