[x] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:
What is the current behavior?
There is no option to format the state / storage value while synchronising store with storage, while persisting in local storage in raw string format.
Issue Number: #513
What is the new behavior?
The following callback methods are added:
preStoreValueInit: a method that runs before initialising the store with a saved value, used for any required modifications before the value is set for store.
preStorageValueUpdate: a method that runs after saving the store, used for any required modifications before the value is set to storage.
The added callback methods allow storing raw string values in local storage, allowing data encryption / decryption or compression / decompression value to be persisted and parsed.
… (#513)
The
preStoreValueInit
methods allow the modification of state value before it is saved to store.The
preStorageValueUpdate
methods allow the modification of state value before it is saved to storage.Closes: #513
PR Checklist
Please check if your PR fulfils the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
There is no option to format the state / storage value while synchronising store with storage, while persisting in local storage in raw string format.
Issue Number: #513
What is the new behavior?
The following callback methods are added:
preStoreValueInit
: a method that runs before initialising the store with a saved value, used for any required modifications before the value is set for store.preStorageValueUpdate
: a method that runs after saving the store, used for any required modifications before the value is set to storage.Does this PR introduce a breaking change?
packages/persist-state/src/lib/storage.ts
Other information
The added callback methods allow storing raw string values in local storage, allowing data
encryption / decryption
orcompression / decompression
value to be persisted and parsed.