@rehooks/local-storage
Version:
React hook for local-storage
25 lines • 939 B
TypeScript
/**
* Test if localStorage API is available
* From https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#Feature-detecting_localStorage
* @returns {boolean}
*/
export declare function localStorageAvailable(): boolean;
interface IProxyStorage {
getItem(key: string): string | null;
setItem(Key: string, value: string): void;
removeItem(key: string): void;
}
export declare class LocalStorageProxy implements IProxyStorage {
getItem(key: string): string | null;
setItem(key: string, value: string): void;
removeItem(key: string): void;
}
export declare class MemoryStorageProxy implements IProxyStorage {
private _memoryStorage;
getItem(key: string): string | null;
setItem(key: string, value: string): void;
removeItem(key: string): void;
}
export declare const storage: LocalStorageProxy | MemoryStorageProxy;
export {};
//# sourceMappingURL=storage.d.ts.map