init: inital commit

This commit is contained in:
2025-02-20 12:39:27 +01:00
commit 3c77360c9d
38 changed files with 8525 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
const timers = new Map();
/**
* A standard debounce, but uses a string `name` as the key instead of the callback.
*/
export default function (name, callback, duration = 500) {
const existing = timers.get(name);
if (existing) {
clearTimeout(existing);
}
timers.set(
name,
setTimeout(() => {
timers.delete(name);
callback();
}, duration),
);
}