Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

防抖 节流 #94

Open
Lawguancong opened this issue Sep 29, 2021 · 0 comments
Open

防抖 节流 #94

Lawguancong opened this issue Sep 29, 2021 · 0 comments

Comments

@Lawguancong
Copy link
Owner

Lawguancong commented Sep 29, 2021

防抖

节流

区别:

函数防抖只是在最后一次事件后才触发一次函数
函数节流不管事件触发有多频繁,都会保证在规定时间内一定会执行一次真正的事件处理函数

比如在页面的无限加载场景下,我们需要用户在滚动页面时,每隔一段时间发一次 Ajax 请求,而不是在用户停下滚动页面操作时才去请求数据。这样的场景,就适合用节流技术来实现。

参考链接
https://juejin.cn/post/6844904153358008327
https://juejin.cn/post/6844903669389885453
https://juejin.cn/post/6844903662519599111
https://juejin.cn/post/6844903592898330638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant