@svackages/persistent-store
v1.0.3
Published
 # persistent typed store This package allows you to persist your store through localstorage.
Readme

persistent typed store
This package allows you to persist your store through localstorage.
basic usage
Typescript
const myPersistentStore = persistentStore<SomeType>({
key: 'fancyKey',
initValue: null,
});JavaScript
const myPersistentStore = persistentStore({
key: 'fancyKey',
initValue: null,
});clear out localstorage
// in .svelte
$myPersistentStore = null; // undefined will work as well
// in .ts/.js
myPersistentStore.set(null); // undefined will work as welloptional params
you can hook into the read and write cycle to transform values.
readHook?: (storage?: string) => T,
writeHook?: (storeValue: T) => string