// 可设定缓存的值 // export type val_DTYPE = string | number | boolean | Array | { [key: string]: T } | T // // 缓存单位 mm=分 ss=秒 type Unit_DTYPE = 'mm' | 'ss' // 设定替换执行上下文对象函数 interface SetTarget_DTYPE { locaSync: any setStorageSync: (key: string, val: any) => void getStorageSync: (key: string) => any removeStorageSync: (key: string) => void } /** * 设置初始化对象和函数 */ declare const setStorageGlobal: (setTarget: SetTarget_DTYPE) => void; declare const getStorageGlobal: () => Storage | { length: number; clear: () => void; removeItem: (key: string) => void; getItem: (key: string) => any; setItem: (key: string, val: string) => void; key: () => string; }; /** * 持久化设置值 * @param key * @param val * @returns */ declare const setCacheLoca: (key: string, val: any) => boolean; /** * 持久化获取值 * @param key * @returns */ declare const getCacheLoca: (key: string) => T; /** * 设置缓存 * @param key * @param val * @param time 存放时间 默认为0,为0时只更新值不更新缓存时间 * @param unit 分钟单位mm 秒单位ss 默认mm分钟 * @returns */ declare const setCache: (key: string, val: any, time?: number, unit?: Unit_DTYPE) => boolean; /** * 获取缓存 * @param key * @returns */ declare const getCache: (key: string) => T; /** * 删除缓存 * @param key */ declare const delCache: (key: string) => void; /** * 清空记录的缓存名称集合 * @returns */ declare const clearCache: () => void; /** * 计算缓存过期时间 * @param key * @returns 返回秒单位时间 */ declare const comCache: (key: string, unit?: Unit_DTYPE) => number; /** * 设置 cookie * @param cname 键名 * @param cvalue 键值 * @param exdays 过期时间/天 */ declare const setCookie: (cname: string, cvalue: string, exdays: number) => void; /** * 获取 cookie * @param cname 键名 * @returns string */ declare const getCookie: (cname: string) => string | undefined; /** * 清除 cookie * @param name 键名 * @returns string */ declare const clearCookie: (name: string) => void; export { clearCache, clearCookie, comCache, delCache, getCache, getCacheLoca, getCookie, getStorageGlobal, setCache, setCacheLoca, setCookie, setStorageGlobal };