@vegajs/storage
Version:
A flexible and type-safe storage service adapter for TypeScript and JavaScript. Supports various storage mechanisms like localStorage, query strings, and mock storage with both asynchronous and synchronous APIs.
10 lines (9 loc) • 346 B
TypeScript
export interface StorageService {
getItem<Value>(key: string): Promise<Value | null>;
getItemSync<Value>(key: string): Value | null;
setItem<Value>(key: string, value: Value): Promise<void>;
setItemSync<Value>(key: string, value: Value): void;
has(key: string): boolean;
clearItem(key: string): void;
clear(): void;
}