@pagamio/frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
54 lines (53 loc) • 1.57 kB
TypeScript
/**
* @fileoverview Type-safe local storage utility functions
* Provides methods for managing data in localStorage with proper error handling
*/
/**
* Interface for key-value pair storage operations
*/
interface StorageItem {
key: string;
value: unknown;
}
/**
* Gets an item from localStorage with type safety
* @param key - Storage key
* @returns Parsed value or null if not found
*/
export declare function getLocalStorageItem<T>(key: string): T | null;
/**
* Sets multiple items in localStorage
* @param items - Array of key-value pairs to store
*/
export declare function setLocalStorageItems(items: StorageItem[]): void;
/**
* Removes multiple items from localStorage
* @param keys - Array of keys to remove
*/
export declare function removeLocalStorageItems(keys: string[]): void;
/**
* Clears all items from localStorage
*/
export declare function clearLocalStorage(): void;
/**
* Gets the size of localStorage in bytes
* @returns Size in bytes or 0 if not available
*/
export declare function getLocalStorageSize(): number;
/**
* Checks if localStorage is available
* @returns boolean indicating if localStorage is available
*/
export declare function isLocalStorageAvailable(): boolean;
/**
* Gets all keys in localStorage
* @returns Array of localStorage keys
*/
export declare function getLocalStorageKeys(): string[];
/**
* Checks if a key exists in localStorage
* @param key - Key to check
* @returns boolean indicating if key exists
*/
export declare function hasLocalStorageItem(key: string): boolean;
export {};