This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function debounce(func: Function, sleep?: number): EventListener { | |
| let timerMobile: number | undefined | |
| let timer: number | undefined | |
| return function debounced(e: Event): void { | |
| if (!!timer || (!!timerMobile && e.type === "click")) { | |
| return | |
| } | |
| func() | |
| if (typeof sleep !== "undefined" && sleep > 0) { | |
| clearTimeout(timer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * ✅ Use case: | |
| * Validate that a list of string keys matches a TypeScript interface *exactly*: | |
| * - No missing keys | |
| * - No extra keys | |
| * | |
| * 💡 Great for: | |
| * - DTO serialization (`toDBObject`) | |
| * - Form field definitions | |
| * - Schema-driven rendering |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script lang="ts"> | |
| import { SvelteSet } from 'svelte/reactivity'; | |
| import type { FlattenedIssues } from '$lib/components/forms/types.js'; | |
| import Form from '$lib/components/forms/Form.svelte'; | |
| import ValidationIssues from '$lib/components/forms/ValidationIssues.svelte'; | |
| import { commentForm } from './commentForm.remote.js'; | |
| import { commentSchema } from './schema.js'; | |
| let liveIssues: FlattenedIssues<typeof commentSchema> = $state({}); |