my-utils-kit
Version:
A lightweight and type-safe utility library for working with strings, objects, array Performance methods in TypeScript. Includes helpful methods for deep cloning, object transformations, safe access, query string handling, and more — designed for modern J
28 lines (27 loc) • 1.42 kB
TypeScript
export declare function debounce<T extends (...args: any[]) => any>(fn: T, delay: number, immediate?: boolean): (...args: Parameters<T>) => void;
export declare function throttle<T extends (...args: any[]) => any>(fn: T, delay: number, immediate?: boolean): (...args: Parameters<T>) => void;
export declare function memoize<T extends (...args: any[]) => any>(fn: T): T;
export declare const asyncMemoize: <T extends (...args: any[]) => Promise<any>>(fn: T) => Promise<T>;
export declare class OperationBatcher {
private operations;
private executing;
enqueueOperation(fn: () => Promise<any>): void;
private execute;
}
export declare function runCallbackOnUserEvent(callback: () => void, options?: {
events?: (keyof DocumentEventMap)[];
timeout?: number;
}): void;
export declare function loadScriptOnUserEvent(src: string, options?: {
events?: (keyof DocumentEventMap)[];
timeout?: number;
}): void;
export declare function observeElementOnIntersect(selector: string, options: IntersectionObserverInit, callback: (entry: IntersectionObserverEntry) => void): void;
type BreakpointRange = {
min: number;
max: number;
};
type Breakpoints = Record<string, BreakpointRange>;
export declare function getScreenSize(ranges?: Breakpoints): string | undefined;
export declare function watchScreenSize(callback: (size: string | undefined) => void, ranges?: Breakpoints): () => void;
export {};