61

防抖和节流原理分析

 5 years ago
source link: https://juejin.im/post/5b7b88d46fb9a019e9767405
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
窗口的resize、scroll、输入框内容校验等操作时,如果这些操作处理函数是较为复杂或页面频繁重渲染等操作时,在这种情况下如果事件触发的频率无限制,会加重浏览器的负担,导致用户体验非常糟糕。此时我们可以采用debounce(防抖)和throttle(节流)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK