function debounce(f, delay) {
let timeoutId = null;
return function() {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => f.apply(this, arguments), delay);
};
}
function throttle(f, delay) {
let lastCall = -Infinity;
return function() {
const now = +new Date;
if (now - lastCall > delay) {
lastCall = now;
return f.apply(this, arguments);
}
};
}
(function(){
let scrollingStopped;
document.addEventListener("mousewheel", function() {
clearTimeout(scrollingStopped);
let is_scrolling = true;
scrollingStopped = setTimeout( function() {
is_scrolling = false;
console.log("stopped");
}, 500)
})
})();