This commit is contained in:
eewing
2026-02-17 14:10:16 -06:00
parent 2bca5834c5
commit cf73cd3b4c
11246 changed files with 1690552 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
// oxlint-disable-next-line no-explicit-any
export function debounce(fn, wait = 500) {
let timeout = null;
const debounced = (...args) => {
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
fn(...args);
}, wait);
};
debounced.destroy = () => {
if (timeout !== null) {
clearTimeout(timeout);
timeout = null;
}
};
return debounced;
}