Skip to Content
Data SourcesReferenceLocalStorageLocalStorage Class

LocalStorage Class

Implements the KeyValueSource interface, allowing interaction with the browser’s local storage using key-value semantics. It provides methods for retrieving, setting, observing, and removing key-value pairs stored in local storage

@template T = any
The type of the value stored in local storage. Defaults to any

API

class LocalStorage<T = any> implements KeyValueSource<T> { get(key: string): T; set(key: string, value: T): void; remove(key: string): void; observe(key: string): Observable<T>; destroy(): void; }

Example

import {LocalStorage} from '@bitfiber/rx'; const ls = new LocalStorage();
Last updated on