vue3-maplibre-gl
Version:
Vue 3 components and composables for MapLibre GL JS - Build interactive maps with ease
57 lines (56 loc) • 1.88 kB
TypeScript
import { Ref, WatchSource } from 'vue';
/**
* Debounce options interface
*/
interface DebounceOptions {
/** Delay in milliseconds (default: 300) */
delay?: number;
/** Whether to trigger on the leading edge (default: false) */
leading?: boolean;
/** Whether to trigger on the trailing edge (default: true) */
trailing?: boolean;
/** Maximum delay before forcing execution (default: none) */
maxWait?: number;
/** Enable debug logging */
debug?: boolean;
}
/**
* Debounced function interface
*/
interface DebouncedFunction<T extends (...args: any[]) => any> {
(...args: Parameters<T>): void;
cancel: () => void;
flush: () => void;
pending: () => boolean;
}
/**
* Creates a debounced version of a function
*
* @param func - Function to debounce
* @param options - Debounce configuration options
* @returns Debounced function with control methods
*/
export declare function useDebounce<T extends (...args: any[]) => any>(func: T, options?: DebounceOptions): DebouncedFunction<T>;
/**
* Creates a debounced ref watcher
*
* @param source - Watch source
* @param callback - Callback function
* @param options - Debounce and watch options
* @returns Stop function
*/
export declare function useDebouncedWatch<T>(source: WatchSource<T>, callback: (value: T, oldValue: T | undefined) => void, options?: DebounceOptions & {
immediate?: boolean;
deep?: boolean;
flush?: 'pre' | 'post' | 'sync';
}): () => void;
/**
* Creates a debounced ref that updates after a delay
*
* @param initialValue - Initial value
* @param delay - Debounce delay in milliseconds
* @returns Tuple of [debouncedRef, immediateRef, flush, cancel]
*/
export declare function useDebouncedRef<T>(initialValue: T, delay?: number): [Ref<T>, Ref<T>, () => void, () => void];
export {};
//# sourceMappingURL=useDebounce.d.ts.map