Svocal combines the power of Svelte stores with localstorage.
npm i svocal
yarn add svocal
pnpm add svocal
bun add svocal
Import localstorage:
import { localstorage } from 'svocal';
Then you can start using the localstorage:
const store = = localstorage('demo', 1)
const store2 = = localstorage('demo', 1)
store and store2 both use the localstorage key demo so when you set store store2 will also update.
store.set(42);
store2.subscribe(console.log);
Will console.log 42
This even works with different tabs, so svocal can be used to sync state between tabs and windows!
Generated using TypeDoc