Skip to content

Instantly share code, notes, and snippets.

@Takaitra
Takaitra / debounce.js
Last active May 10, 2018 18:58 — forked from Jon-Alonso/debounce.js
ES6 Debounce function
export function debounce (func, delay = 500) {
let timeout;
return function (...args) {
clearTimeout(timeout);
timeout = setTimeout(() => { func.apply(this, args) }, delay);
};
}