@statesync/persistence / SessionStorageBackendOptions
Interface: SessionStorageBackendOptions
Defined in: persistence/src/storage/session-storage.ts:10
Configuration options for the sessionStorage storage backend.
Allows customization of the storage key and serialization behavior used when persisting snapshot data to the browser's sessionStorage API.
Properties
deserialize()?
optional deserialize: (data) => SnapshotEnvelope<unknown>;Defined in: persistence/src/storage/session-storage.ts:37
Custom deserialization function for converting a stored string back into a snapshot envelope.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | string | The raw string retrieved from sessionStorage. |
Returns
SnapshotEnvelope<unknown>
The deserialized snapshot envelope.
Default
JSON.parsekey
key: string;Defined in: persistence/src/storage/session-storage.ts:17
The key under which snapshot data is stored in sessionStorage.
Must be unique per application or state instance to avoid collisions with other data stored in the same origin's sessionStorage.
serialize()?
optional serialize: (snapshot) => string;Defined in: persistence/src/storage/session-storage.ts:27
Custom serialization function for converting a snapshot envelope into a string suitable for sessionStorage storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
snapshot | SnapshotEnvelope<unknown> | The snapshot envelope to serialize. |
Returns
string
A string representation of the snapshot.
Default
JSON.stringify