export declare function debounce) => any>(fn: T, wait?: number, runFirst?: boolean): (...args: Array) => void; export declare function debounceRAF) => any>(fn: T): { (...args: Array): void; cancel(): void; }; export declare function throttleRAF) => any>(fn: T): { (...args: Array): void; cancel(): void; }; /** * 颜色池 */ export declare class ColorPool { pool: Array; tmpPool: Array; constructor(pool: Array); /** * 返回指定位置颜色,或者从颜色池随机返回一个颜色 * @param index * @returns */ pick(index?: number): string; } /** * 生成随机字符串 * @param prefix 前缀 * @param length 字符串长度 */ export declare function uniqueId(prefix?: string, length?: number): string; /** * 将数组拆分成多个指定长度的区块 * @param arr 被拆分数组 * @param size 区块长度 */ export declare function chunk(arr?: any[], size?: number): any[][]; /** * 异步some * @param array 遍历数组 * @param judgeFn 判断函数 */ export declare function asyncSome(array: Array, judgeFn: (arrayItem: T) => Promise): Promise; /** * 根据path从对象中获取值 */ export declare function getValueByPath(obj: object, path: string): any; /** * 根据path设置对象中的值 */ export declare function setValueByPath(obj: { [k: string]: any; }, path: string, value: any): void; /** * 将数组中的某一项移到第一项 * @param arr 被移动的数组 * @param item 需要移动的项 * @returns Array */ export declare function moveToFirst(arr: T[], item: T): T[]; /** * 转换为字符串,对于undefined、null、NaN转换为'' * @param val * @returns string */ export declare function formateToString(val: unknown): string; /** * 使用图片url请求加载图片 * @param src s * @returns */ export declare function requestImage(src: string): Promise; /** * 从对象中挑选属性 */ export declare function pick(source: object, keys: string[]): Record; /** * 分批执行大量任务 * tasks: 任务列表 Array<() => void> * sheduler:调度器函数,用于分批执行任务 * runChunk:分批执行函数 (toContinue:(currentTaskIndex: number)=>boolean)=>void * toContinue:(currentTaskIndex: number)=>boolean 是否继续执行的条件 */ export declare function performTask(tasks: Array<() => void>, sheduler: (runChunk: (toContinue: (currentTaskIndex: number) => boolean) => void) => void): void; /** * 分时执行大量任务,使用requestIdleCallback * tasks: 任务列表 Array<() => void> */ export declare function idlePerformTask(tasks: Array<() => void>): void; /** * polyfill to Promise.withResolvers (ES2024) */ export declare function promiseWithResolvers(): { promise: Promise; resolve: (value: T | PromiseLike) => void; reject: (reason?: any) => void; };