function
debounce()
Option name | Type | Description |
---|---|---|
func | Function | |
delay | Integer |
function debounce(func, delay) {
var timer;
return function() {
var args = arguments;
if (timer) window.clearTimeout(timer);
timer = window.setTimeout(function() {
func.apply(this, args);
}, delay);
};
}
Base.exportjQuery(debounce, 'debounce');
return debounce;
}));