Type Alias: SyncConfig<State>
SyncConfig<
State>:object
Defined in: libs/ngrx-toolkit/src/lib/storage-sync/with-storage-sync.ts:26
Type Parameters
• State
Type declaration
autoSync?
optionalautoSync: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()?
optionalparse: (stateString) =>State
Function used to parse the state coming from storage.
JSON.parse() by default
Parameters
stateString
string
Returns
State
select()?
optionalselect: (state) =>unknown
Function to select that portion of the state which should be stored.
Returns the whole state object by default
Parameters
state
State
Returns
unknown
storage()?
optionalstorage: () =>Storage
Returns
Storage
Deprecated
Use withSessionStorage instead. Factory function used to switch to sessionStorage.
localStorage by default
stringify()?
optionalstringify: (state) =>string
Function used to transform the state into a string representation.
JSON.stringify() by default
Parameters
state
State
Returns
string