Whether or not to look for existing values before using the defaults passed
Whether or not to check localStorage when an object key is retrieved
An optional unique identifier. Prefixes all keys in localStorage
with this id (eg. stores foo
in localStorage as myid.foo
for myid
)
Whether to modify values on the proxied object or leave it as-is.
Doesn't do anything if passed with partial
for storeObject
Called whenever a key should be retrieved
The key's value
Modify an object before setting it in localStorage or reading it. Called after validate. Any valiation should be done in validate and not here
A partial version of the originally passed object, containing only the key being get/set
The key being get/set
A potentially modified version of the object originally passed. Only the key used in the value param will be changed in localStorage
Function to parse object. Defaults to JSON.parse
.
Any validation should NOT be done here, but in the validate method
Called whenever a key should be set
The value being set
Function to stringify object. Defaults to JSON.stringify
.
Any validation should NOT be done here, but in the validate method
Validate an object before setting it in localStorage or reading it. Can confirm/deny if the object is valid, along with an optional error message if it is invalid
A partial version of the originally passed object, containing only the key being get/set
The key being get/set
A boolean to confirm validity or false and optionally an Error instance to deny validity
Generated using TypeDoc
Configuration for storeSeparate