import { IRecordID } from '../../shared/types.js'; import { IWebStorageStore } from './types.js'; /** * Web Storage Store * Object in charge of interacting with the Browser's Storage API. This API is used by * Window.localStorage & Window.sessionStorage. * https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage * https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage * https://developer.mozilla.org/en-US/docs/Web/API/Storage */ declare class WebStorageStore implements IWebStorageStore { readonly id: string; private readonly __mechanism; private __isCompatible; private __webStorage; private readonly __tempMemory; constructor(id: string, mechanism: 'localStorage' | 'sessionStorage'); /** * Checks if the storage mechanism is supported by the browser. If so, it sets the __isCompatible * prop to true. */ private __checkCompatibility; /** * Runs the tests to check if the storage mechanism is supported by the browser and returns true * if it is. * @returns boolean */ isCompatible(): boolean; /** * Retrieves a record by ID. If no ID is provided, it retrieves the data stored at the root of the * store. * @param id? * @returns T | undefined */ get(id?: IRecordID): T | undefined; /** * Writes data on a record based on its ID. If no ID is provided, it writes at the root of the * store. * @param id * @param data */ set(id: IRecordID, data: T): void; /** * Deletes the record based on its ID. If no ID is provided, it deletes the root of the store. * @param id? */ del(id?: IRecordID): void; } export { WebStorageStore };