Začetni commit projekta rezervacije

This commit is contained in:
Mark Poljanšek committed 2025-04-23 20:19:33 +02:00
commit 328731b32f
56062 files changed
+2485242

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
export interface Cancelable {
clear(): void;
}
export default function debounce<T extends (...args: any[]) => any>(func: T, wait?: number): T & Cancelable;
+17
View File
@@ -0,0 +1,17 @@
// Corresponds to 10 frames at 60 Hz.
// A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
export default function debounce(func, wait = 166) {
let timeout;
function debounced(...args) {
const later = () => {
// @ts-ignore
func.apply(this, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
}
debounced.clear = () => {
clearTimeout(timeout);
};
return debounced;
}
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./debounce.js";
export * from "./debounce.js";
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./debounce.js";
export * from "./debounce.js";