UNPKG

flowbite-svelte

Version:

Flowbite components for Svelte

18 lines (17 loc) 827 B
/** * Create a mutual debounce for two opposing actions. * Calling one action cancels any pending execution of the other. * * @param actionA - First action (e.g., openDialog) * @param actionB - Second action (e.g., closeDialog) * @param delayFunc - Function returning delay in milliseconds (default: 300ms) * @returns Object with mutual debounce control methods * * @example * const [openDialogDeb, closeDialogDeb] = createMutualDebounce(openDialog, closeDialog, () => 300); * openDialogDeb(); // Schedule open * closeDialogDeb(); // Cancel open, schedule close */ type Func = (...args: any[]) => unknown; export declare function createMutualDebounce<A extends Func, B extends Func>(actionA: A, actionB: B, delayFunc: () => number): [(...args: Parameters<A>) => void, (...args: Parameters<B>) => void]; export {};