hugo-theme-zzo/assets/js/helper/throttle.js

13 lines
250 B
JavaScript
Raw Normal View History

2020-12-08 20:12:03 +00:00
function throttle(callback, limit) {
var waiting = false;
return function () {
if (!waiting) {
callback.apply(this, arguments);
waiting = true;
setTimeout(function () {
waiting = false;
}, limit);
}
};
}