mirror of
https://github.com/czhu12/canine.git
synced 2026-01-04 02:30:28 -06:00
13 lines
239 B
JavaScript
13 lines
239 B
JavaScript
export function debounce(func, wait) {
|
|
let timeout;
|
|
return function(...args) {
|
|
const later = () => {
|
|
clearTimeout(timeout);
|
|
func(...args);
|
|
};
|
|
clearTimeout(timeout);
|
|
timeout = setTimeout(later, wait);
|
|
}
|
|
}
|
|
|