打赏

debounce 防抖动函数

http://lodash.think2011.net/debounce

_.debounce(func, [wait=0], [options])

创建一个防抖动函数。 该函数会在 wait 毫秒后调用 func 方法。

返回具有防抖动功能的函数

// 避免窗口在变动时出现昂贵的计算开销。
jQuery(window).on('resize', _.debounce(calculateLayout, 150));

 

posted @ 2018-06-15 16:52  孟繁贵  阅读(797)  评论(0编辑  收藏  举报
TOP