svelte-cachedb
A JSON database leveraging Svelte's writable stores and local storage
Getting Started
-
Install
svelte-cachedb
:yarn add -D svelte-cachedb
-
Add context provider to Svelte
<!-- src/index.svelte --> -
Access with
getContext('cachedb')
Customization
Property | Default | Description |
---|---|---|
contextKey |
cachedb |
key used to store in Svelte's context (i.e. getContext('cachedb') ) |
dbName |
cachedb |
name used for localStorage database name |
dbKey |
svelte-cachedb |
value used to store database in localStorage (i.e. localStorage.getItem('svelte-cachedb') ) |
version |
1 | value used for storing database version |
autoSave |
true | when the db store updates, autosaves to localStorage |
In Action