browser-storage-adapter
Version:
Browser storage adapter to crud 1-n different stores simultaneously
31 lines (30 loc) • 1.17 kB
TypeScript
import { Options, OptionsInput } from './type';
import { Driver } from './constants';
export declare class Adapter {
readonly options: Options;
protected state: Record<string, any>;
constructor(options: OptionsInput);
getKeyWithNamespace(key: string): string;
set(key: string, value: any): any;
get(key: string): any;
getAll(): any;
sync(key: string, defaultValue?: any): any;
remove(key: string): void;
initState(): void;
setState<T>(key: string, value: T): void;
getState(key: string): any;
removeState(key: string): void;
getBrowserStorageItems(type: `${Driver}`): Record<string, any>;
setLocalStorageItem(key: string, value: any): void;
getLocalStorageItem(key: string): any;
getLocalStorageItems(): any;
removeLocalStorageItem(key: string): void;
setSessionStorageItem(key: string, value: any): any;
getSessionStorageItem(key: string): any;
getSessionStorageItems(): any;
removeSessionStorageItem(key: string): void;
getCookies(): Record<string, any>;
setCookie(key: string, value: any): void;
getCookie(key: string): any;
removeCookie(key: string): void;
}