@grandlinex/react-components
Version:
15 lines (14 loc) • 674 B
TypeScript
export type LocalStorageEvent = 'update' | 'flag-update';
export default class LocalStorage {
static events: Map<string, any[]>;
static on<T>(name: LocalStorageEvent, listener: (d: T) => void): void;
static removeListener(name: LocalStorageEvent, listenerToRemove: any): void;
private static emit;
static save(key: string, val: string): void;
static load(key: string, defaultValue?: string): string;
static jsonSave<T = any>(key: string, val: T): boolean;
static jsonLoad<T = any>(key: string): T | null;
static flagSave(key: string, val: boolean): void;
static flagLoad(key: string): boolean;
static delete(key: string): void;
}