kawkab-frontend
Version:
Kawkab frontend is a frontend library for the Kawkab framework
42 lines (41 loc) • 1.24 kB
TypeScript
/**
* Checks if sessionStorage is available and usable.
* @returns {boolean} True if supported, false otherwise.
*/
declare function isSupported(): boolean;
/**
* Retrieves a value from sessionStorage and parses it as JSON.
* @param key The key to retrieve.
* @returns The stored value, or null if not found or on error.
*/
declare function get<T = any>(key: string, defaultValue?: T): T | null;
/**
* Stores a value in sessionStorage after serializing it to JSON.
* @param key The key to store the value under.
* @param value The value to store (can be any JSON-serializable type).
*/
declare function set(key: string, value: any): void;
/**
* Checks if a key exists in sessionStorage.
* @param key The key to check.
* @returns True if the key exists, false otherwise.
*/
declare function has(key: string): boolean;
/**
* Removes an item from sessionStorage.
* @param key The key to remove.
*/
declare function remove(key: string): void;
/**
* Clears all items from sessionStorage.
*/
declare function clear(): void;
export declare const SessionStorage: {
get: typeof get;
set: typeof set;
has: typeof has;
remove: typeof remove;
clear: typeof clear;
isSupported: typeof isSupported;
};
export {};