UNPKG

@geogirafe/lib-geoportal

Version:

GeoGirafe is a flexible application to build online geoportals.

37 lines (36 loc) • 1.56 kB
import GirafeSingleton from '../../base/GirafeSingleton.js'; import { UserDataConfig } from '../configuration/girafeconfig.js'; /** * Manages user data storage and retrieval across different storage sources. * The class supports localStorage and server as storage options (server-side implementation currently not available). * It provides functionality to set, get, save, and delete user data while maintaining the flexibility to target specific paths * within the user data object. */ declare class UserDataManager extends GirafeSingleton { private readonly storageKey; private config; private allowSaveUserPreferences; initializeFromConfig(config: UserDataConfig): void; private userData?; private userDataPromise?; /** * Retrieves a specific part of the user data defined by the storage path. * @param storagePath path in the user data object to the requested value. * @returns the partial user data object. */ getUserData(storagePath: string): Promise<unknown>; getFromLocalStorage(storagePath: string): any; private extractValue; private load; private loadFromLocalStorage; private loadFromServer; saveUserData(storagePath: string, newValue: unknown): Promise<void>; saveToLocalStorage(storagePath: string, newValue: unknown): void; private save; private writeToLocalStorage; private writeToServer; deleteUserData(storagePath: string): Promise<void>; deleteAllUserData(): Promise<void>; private deleteFromServer; } export default UserDataManager;