Skip to main content

Type Alias: SyncConfig<State>

SyncConfig<State>: object

Defined in: libs/ngrx-toolkit/src/lib/with-storage-sync.ts:33

Type Parameters

State

Type declaration

autoSync?

optional autoSync: boolean

Flag indicating if the store should read from storage on init and write to storage on every state change.

true by default

key

key: string

The key which is used to access the storage.

parse()?

optional parse: (stateString) => State

Function used to parse the state coming from storage.

JSON.parse() by default

Parameters

stateString

string

Returns

State

select()?

optional select: (state) => Partial<State>

Function to select that portion of the state which should be stored.

Returns the whole state object by default

Parameters

state

State

Returns

Partial<State>

storage()?

optional storage: () => Storage

Factory function used to select the storage.

localstorage by default

Returns

Storage

stringify()?

optional stringify: (state) => string

Function used to tranform the state into a string representation.

JSON.stringify() by default

Parameters

state

State

Returns

string