WebStorageAdapterOptions
Properties
Section titled “Properties”onError?
Section titled “onError?”optional onError?: (error, operation) => void;Called when a storage operation fails: blocked storage, corrupt JSON, a full quota. Persistence stays best-effort either way — this is the observability seam (telemetry, a “your changes may not be saved” notice), not a recovery path. Errors thrown by the callback itself are swallowed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
error | unknown |
operation | "read" | "write" | "remove" |
Returns
Section titled “Returns”void
serializer?
Section titled “serializer?”optional serializer?: Serializer;How values become text. Defaults to JSON, which refuses anything it would
silently change — a Date, a Map, an undefined — rather than write a
value that reads back different.
Pass devalue or superjson to carry those instead. Not bundled: they cost 3.4-3.6 kB brotlied against a whole-library budget of 7.3 kB, and most state is JSON-shaped.