jz-tool-lib
Version:
项目常用公共方法集合
28 lines (27 loc) • 918 B
TypeScript
/**
* @description StorageService 抽象类,只用来创建子类
* */
declare abstract class StorageManager {
storage: Storage;
protected constructor(storage: 'localStorage' | 'sessionStorage');
getItem(key: string): any;
batchGetItem(keys: string[]): "" | Record<string, undefined>;
setItem(key: string, value: any): void;
batchSetItem(info: Record<string, unknown>): void;
removeItem(key: string): void;
batchRemoveItem(keys: string[]): void;
clear(): void;
}
declare class LocalService extends StorageManager {
static instance: LocalService;
constructor();
static getInstance(): LocalService;
}
declare class SessionService extends StorageManager {
static instance: SessionService;
constructor();
static getInstance(): SessionService;
}
export declare const LocalStorage: LocalService;
export declare const SessionStorage: SessionService;
export {};