Skip to content

Instantly share code, notes, and snippets.

@balsanka
Created June 11, 2022 19:00
function debouncer(callBack, timer) {
let timeoutId;
return function () {
let context = this;
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
callBack.apply(context, arguments);
clearTimeout(timeoutId);
}, timer);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment