svelte-tauri-store
v0.0.16
Published
A Svelte store that persists to tauri-plugin-store. Supports changes across multiple tabs.
Downloads
7
Readme
svelte-tauri-store
A Svelte store that persists to tauri-plugin-store. Supports changes across multiple tabs.
Installation
npm install svelte-tauri-store
Usage
Define the store:
import { persisted } from 'svelte-tauri-store'
export const preferences = persisted('preferences', {
theme: 'dark',
pane: '50%',
...
})
Then when you want to use the store:
import { get } from 'svelte/store'
import { preferences } from './stores'
preferences.subscribe(...) // subscribe to changes
preferences.update(...) // update value
preferences.set(...) // set value
get(preferences) // read value
$preferences // read value with automatic subscription
License
MIT