All Projects → MacFJA → svelte-persistent-store

MacFJA / svelte-persistent-store

Licence: MIT License
A Svelte store that keep its value through pages and reloads

Programming Languages

typescript
32286 projects
Svelte
593 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to svelte-persistent-store

Immortaldb
🔩 A relentless key-value store for the browser.
Stars: ✭ 2,962 (+2568.47%)
Mutual labels:  localstorage, indexeddb, sessionstorage
elm-storage
Unified interface for accessing and modifying LocalStorage, SessionStorage and Cookies
Stars: ✭ 13 (-88.29%)
Mutual labels:  cookie, localstorage, sessionstorage
Proxy Storage
Provides an adapter for storage mechanisms (cookies, localStorage, sessionStorage, memoryStorage) and implements the Web Storage interface
Stars: ✭ 10 (-90.99%)
Mutual labels:  cookie, localstorage, sessionstorage
client-persist
Offline storage for your web client. Supports IndexedDB, WebSQL, localStorage and sessionStorage with an easy to crawl with API.
Stars: ✭ 14 (-87.39%)
Mutual labels:  localstorage, indexeddb, sessionstorage
Brownies
🍫 Tastier cookies, local, session, and db storage in a tiny package. Includes subscribe() events for changes.
Stars: ✭ 2,386 (+2049.55%)
Mutual labels:  cookie, localstorage, sessionstorage
persistence
💾 Persistence provides a pretty easy API to handle Storage's implementations.
Stars: ✭ 18 (-83.78%)
Mutual labels:  localstorage, indexeddb, sessionstorage
focus-svelte
focus lock for svelte
Stars: ✭ 18 (-83.78%)
Mutual labels:  svelte, sveltejs
todomvc-svelte
TodoMVC built with Svelte and Store
Stars: ✭ 34 (-69.37%)
Mutual labels:  store, svelte
svelte-meteor-data
Reactively track Meteor data inside Svelte components
Stars: ✭ 14 (-87.39%)
Mutual labels:  svelte, sveltejs
svelte-hamburgers
Custom Hamburger Icons in Svelte with ease
Stars: ✭ 27 (-75.68%)
Mutual labels:  svelte, sveltejs
mathesar
Web application providing an intuitive user experience to databases.
Stars: ✭ 95 (-14.41%)
Mutual labels:  svelte, sveltejs
http-interceptors
The Web apps in this monorepo make HTTP requests and require uniform consistency in how they are executed and handled. This monorepo demonstrates the same app written with Angular and with Svelte. Each app uses HTTP interceptors. The Angular app uses HttpClient and its interceptors while the Svelte app uses Axios and its interceptors.
Stars: ✭ 46 (-58.56%)
Mutual labels:  svelte, sveltejs
svelte-component-library-template
A base for building Svelte component library.
Stars: ✭ 62 (-44.14%)
Mutual labels:  svelte, sveltejs
svelte-local-storage-store
Adds pub/sub to local storage.
Stars: ✭ 194 (+74.77%)
Mutual labels:  localstorage, svelte
svelte-starter-kit
Svelte with brilliant bells and useful whistles
Stars: ✭ 384 (+245.95%)
Mutual labels:  svelte, sveltejs
cv
My online CV using Svelte
Stars: ✭ 35 (-68.47%)
Mutual labels:  svelte, sveltejs
svelte3-translation-ru
Russian translation of the official Svelte resources
Stars: ✭ 49 (-55.86%)
Mutual labels:  svelte, sveltejs
memento-svelte-electron-typescript
Template to create a desktop app with Svelte, TailwindCSS, Electron and TypeScript (with electron-updater, electron-reload and electron-builder)
Stars: ✭ 27 (-75.68%)
Mutual labels:  svelte, sveltejs
svelte-pagination
Example of a pagination component in Svelte
Stars: ✭ 15 (-86.49%)
Mutual labels:  svelte, sveltejs
programmingtil-svelte
No description or website provided.
Stars: ✭ 59 (-46.85%)
Mutual labels:  svelte, sveltejs

Svelte Persistent store

A Svelte store that keep its value through pages and reloads

Installation

npm install @macfja/svelte-persistent-store

Usage

import { persist, localStorage } from "@macfja/svelte-persistent-store"
import { writable } from "svelte/store"

let name = persist(writable('John'), localStorage(), 'name')

$name = 'Jeanne Doe'

// if you reload the page the value of $name is 'Jeanne Doe'

Features

  • Multiple storages (Allow to have the best suited usage depending on your use case)
  • Work with any Svelte store
  • Work with classes, objects, primitive

Storages

There are 4 storages built-in:

  • localStorage(), that use window.localStorage to save values
  • sessionStorage(), that use window.sessionStorage to save values
  • cookieStorage(), that use document.cookie to save values
  • indexedDBStorage(), that use window.indexedDB to save values

You can add more storages, you just need to implement the interface StorageInterface

Documentation

Documentation and examples can be generated with npm run doc, next open docs/index.html with your favorite web browser.

(Hint: If you don't want to generate the docs, a part of the example and documentation are available here)

Contributing

Contributions are welcome. Please open up an issue or create PR if you would like to help out.

Read more in the Contributing file

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].