Class LocalStorageStatePersistence
- Namespace
- BlazOrbit.Components
- Assembly
- BlazOrbit.dll
localStorage-backed implementation of IDataCollectionStatePersistence.
Goes through the browser's built-in localStorage.getItem /
localStorage.setItem via inline JS interop — no module load, no extra TypeScript.
Failures (SSR without circuit, runtime disposed, storage quota) are swallowed so a
missing browser environment never crashes the grid.
public sealed class LocalStorageStatePersistence : IDataCollectionStatePersistence
- Inheritance
-
objectLocalStorageStatePersistence
- Implements
Constructors
LocalStorageStatePersistence(IJSRuntime)
Initializes a new LocalStorageStatePersistence.
public LocalStorageStatePersistence(IJSRuntime js)
Parameters
jsIJSRuntime
Methods
LoadAsync(string)
Reads a previously persisted snapshot. Returns null when no payload is stored, the entry is malformed, or the underlying storage is unavailable (e.g. SSR without a JS runtime).
public ValueTask<string?> LoadAsync(string key)
Parameters
keystring
Returns
- ValueTask<string>
SaveAsync(string, string)
Persists a JSON-shaped payload under key. Implementations swallow
transient storage failures so consumers don't need to wrap each call in a try/catch.
public ValueTask SaveAsync(string key, string payload)
Parameters
keystringpayloadstring
Returns
- ValueTask