43

防抖(Debounce) & 节流(Throttle)

 4 years ago
source link: https://juejin.im/post/5caf39d8f265da03826106b8
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, touchmove,scroll等操作时,绑定的函数触发的频率会很高,如果该函数稍微复杂一些,响应速度会远远跟不上触发频率,便会出现卡顿,延迟,假死等现象。 下面来看一个例子,根据输入框输入的

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK