A Storage-interface-compatible wrapper around localStorage that silently
no-ops (rather than throwing) when it's unavailable - SSR, private-browsing
modes that disable storage, or a disabled-storage policy.
Ported from data-sheet-portal, where it's used as oidc-client-ts's
WebStorageStateStore({ store: safeLocalStorage }) - see AuthService's
userStore option, which accepts exactly this shape. Complements
isStorageAvailable (a boolean check the caller branches on) with a
drop-in object that never needs that check at the call site.
A
Storage-interface-compatible wrapper aroundlocalStoragethat silently no-ops (rather than throwing) when it's unavailable - SSR, private-browsing modes that disable storage, or a disabled-storage policy.Ported from
data-sheet-portal, where it's used asoidc-client-ts'sWebStorageStateStore({ store: safeLocalStorage })- seeAuthService'suserStoreoption, which accepts exactly this shape. ComplementsisStorageAvailable(a boolean check the caller branches on) with a drop-in object that never needs that check at the call site.