Skip to content

@continuum-js/std


@continuum-js/std / persist

Function: persist()

persist<T>(key, b, storage?): Unlisten

Defined in: index.ts:243

Mirror every value of b (including the current one) into storage as JSON. Best-effort: a throwing setItem (quota, private mode) is swallowed — the network must not break because a mirror did. Returns the unlisten; tie it to a scope (onCleanup(persist(key, b))) or keep it for a manual stop.

Type Parameters

T

T

Parameters

key

string

b

State<T>

storage?

StorageLike | undefined

Returns

Unlisten