UNPKG

wx-request-plus

Version:

增强型微信小程序请求库,支持错误处理、Promise、缓存、弱网处理、请求队列等功能

24 lines (23 loc) 1.86 kB
import { RequestConfig, ErrorType, RequestError, NetworkStatus } from './types'; export declare function deepMerge<T>(...objects: any[]): T; export declare function buildURL(url: string, baseURL?: string, params?: Record<string, any>): string; export declare function isAbsoluteURL(url: string): boolean; export declare function combineURLs(baseURL: string, relativeURL: string): string; export declare function serializeParams(params: Record<string, any>): string; export declare function generateCacheKey(config: RequestConfig): string; export declare function sortObjectKeys(obj: any): any; export declare function createError(message: string, config: RequestConfig, status?: number, data?: any, headers?: Record<string, string>, type?: ErrorType): RequestError; export declare function delay(ms: number): Promise<void>; export declare function isNetworkError(error: any): boolean; export declare function getNetworkStatus(): Promise<NetworkStatus>; export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void; export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void; export declare function shouldCache(config: RequestConfig): boolean; export declare function getPriority(config: RequestConfig): number; export declare function normalizeHeaderName(headers: Record<string, string>, normalizedName: string): void; export declare function parseHeaders(headers: string): Record<string, string>; export declare function isJSONData(data: any): boolean; export declare function generateRandomId(): string; export declare function get(obj: any, path: string, defaultValue?: any): any; export declare function getValueByPath(obj: any, path: string, defaultValue?: any): any; export declare function sha256(str: string): string;