CSettings
Namespaced JSON settings backed by localStorage. Storage errors switch this instance to an in-memory cache of values already read or written. Those changes last for this instance's lifetime only. Pass null as storage to explicitly use memory (also the default outside browsers).
import { CSettings } from "canvas-toolkit-lib";Declared members
constructor(namespace: string, storage?: Storage | null);isPersistent(): boolean;Whether this instance still uses persistent storage. Access errors turn this off.
value(key: string): unknown;Reads JSON or returns null when absent/corrupt.
value<T>(key: string, defaultValue: T): T;The caller supplies the expected type; JSON content is not schema-validated.
setValue(key: string, value: unknown): void;Stores an independent JSON snapshot. Invalid/non-JSON values throw before changing anything; storage failures are handled by the memory fallback.
contains(key: string): boolean;Includes stored null and false; corrupted JSON counts as an existing key.
remove(key: string): void;