npm.io
1.1.1 • Published 4 years ago

reapex-plugin-local-storage

Licence
MIT
Version
1.1.1
Deps
0
Size
70 kB
Vulns
0
Weekly
0
Stars
57

Reapex local storage plugin

Easily persist and restore data between state and local storage

image

import { App } from 'reapex'
import createLocalStoragePlugin from 'reapex-plugin-local-storage'

// 1. Initialize the plugin
const { plugin, persist } = createLocalStoragePlugin()
const app = new App()

// 2. register the plugin
app.plugin(plugin)

// 3. Simply wrap a `model` with `persist`
const UserModel = app.model('User', { name: '', age: 0 })
persist(UserModel)

Keywords