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?
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
) =>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()?
optional
storage: () =>Storage
Returns
Storage
Deprecated
Use withSessionStorage instead. Factory function used to switch to sessionStorage.
localStorage
by default
stringify()?
optional
stringify: (state
) =>string
Function used to transform the state into a string representation.
JSON.stringify()
by default
Parameters
state
State
Returns
string