@jsheaven/store
v1.0.2
Published
A reactive, observed and auto-persisted object store
Downloads
4
Readme
A reactive, observed and auto-persisted object store
- As a developer, I want to have an object store simply persisted
- As a developer, I want to hook into changes at every depth reactively
- ✅ Offers the
@jsheaven/observed
reactive object API - ✅ Integrates with
simply-persist
to save on any change - ✅ Middleware function API allows to hook what is read and written (e.g. for encryption)
- ✅ Available as a simple API
- ✅ Just
387 byte
nano sized (ESM, gizpped) - ✅ Tree-shakable and side-effect free
- ✅ Runs on Windows, Mac, Linux, CI tested
- ✅ First class TypeScript support
- ✅ 100% Unit Test coverage
- yarn:
yarn add @jsheaven/store
- npm:
npm install @jsheaven/store
import { store } from '@jsheaven/store'
export interface MyStore {
a: boolean
b: number
c: {
foo: string
}
}
const myStore = await store<MyStore>({
name: 'myStore',
initialValue: { a: true, b: 1, c: { foo: 'nice!' }} },
provider: 'session' // from `simply-persist`; persists to SessionStorage
})
const { store } = require('@jsheaven/store')
// same API like ESM variant