Javascript Throttle Debounce应用介绍
Throttle 无视一定时间内所有的调用,适合在发生频度比较高的,处理比较重的时候使用。 代码如下: var throttle = function (func, threshold, alt) { var last = Date.now(); threshold = threshold || 100; return function () { var now = Date.now(); if (now – last < threshold) { if (alt) { alt.apply(this, arguments); } return; } last = now; func.a
下载地址
用户评论