Function storeGenerator
- storeGenerator(
opts: {
deserialize?: (value: string, ...rest: any[]) => any;
serialize?: (value: any, ...rest: any[]) => string;
storage: Storage;
},
): StorageStores Parameters
- opts: {
deserialize?: (value: string, ...rest: any[]) => any;
serialize?: (value: any, ...rest: any[]) => string;
storage: Storage;
}Generator options.
Optional
deserialize?: (value: string, ...rest: any[]) => anyReplace with custom deserialization; default:
JSON.parse
.Optional
serialize?: (value: any, ...rest: any[]) => stringReplace with custom serialization; default:
JSON.stringify
.storage: Storage
The web storage source.
Returns StorageStores
A complete set of store helper functions and associated storage API instance and serialization strategy.
- opts: {
Generates derived, readable, writable helper functions wrapping the given Storage API provided with any additional customization for data serialization. By default, JSON serialization is used.