export interface IAsyncStorage { /** * Get the value for the given key. */ getItem(key: string): Promise; /** * Set the value for the given key. */ setItem(key: string, value: string): Promise; /** * Remove the value for the given key. */ removeItem(key: string): Promise; /** * Clear all data for this storage. */ clear(): Promise; } /** * Error thrown when AsyncStorage fails to get/set/remove/clear the storage. */ export declare class AsyncStorageError extends Error { constructor(message: string); } /** * A wrapper class for AsyncStorage for strict typing and inbuilt JSON serialization. * * TODO: add support for custom JSON serializer if needed */ export declare class AsyncStorage { private storage; private keyPrefix; /** * Create a new AsyncStorage instance. The keyPrefix is used to namespace the keys in the * underlying storage layer. It's optional, but recommended to avoid key collisions. */ constructor(storage: IAsyncStorage, keyPrefix?: string); /** * Create a new AsyncStorage instance with initial data. */ static withInitialData(storage: IAsyncStorage, initialData: Record, keyPrefix?: string): Promise>; /** * Get the value for the given key. */ getItem(key: string): Promise; /** * Set the value for the given key. */ setItem(key: string, value: T): Promise; /** * Remove the value for the given key. */ removeItem(key: string): Promise; /** * Calling this method will clear all data for the given storage layer. * * It might lead to unexpected behavior and/or data loss if other modules are using the same storage layer. */ clear(): Promise; } /** * A class to manage the storage layer. */ declare class StorageLayer { private storage; isInitialized(): boolean; initialize(storage: IAsyncStorage): void; getStorage(): IAsyncStorage; } /** * The global storage layer instance. */ export declare const storageLayer: StorageLayer; export {};