Open unliar opened 3 years ago
节流函数永远只执行第一个被激活的函数。
function throttle(func, wait) { var timeout; return function() { context = this; args = arguments; if (!timeout) { timeout = setTimeout(function(){ timeout = null; func.apply(context, args) }, wait) } } }
节流函数永远只执行第一个被激活的函数。