function throttle(fn, delay, interval = delay) {
let timer = undefined;
let start = Date.now();
return function() {
const _self = this;
const args = arguments;
let current = Date.now();
clearTimeout(timer);
if (current - start < interval)
return (timer = setTimeout(() => fn.apply(_self, args), delay));
fn.apply(_self, args);
start = current;
};
}