# vuex-class-persist

> Note: this project is a wrapper around Vuex-Persist and is not intended to steal any of ChampionSwimmer's code.

Latest version **0.0.1-beta.2** (published 2018-09-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install vuex-class-persist
pnpm add vuex-class-persist
yarn add vuex-class-persist
bun add vuex-class-persist
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1-beta.2 |
| Published | 2018-09-10 |
| First published | 2018-08-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Colten Pilgreen |
| Maintainers | coltenp |

## Links

- npm: https://www.npmjs.com/package/vuex-class-persist
- Repository: https://github.com/ColtenP/vuex-class-persist
- Homepage: https://github.com/ColtenP/vuex-class-persist#readme
- Issues: https://github.com/ColtenP/vuex-class-persist/issues
- npm.io page: https://npm.io/package/vuex-class-persist

## Dependencies (5)

- [vue](https://npm.io/package/vue.md) ^2.5.17
- [vuex](https://npm.io/package/vuex.md) ^3.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [typescript](https://npm.io/package/typescript.md) ^3.0.1
- [vuex-persist](https://npm.io/package/vuex-persist.md) ^1.4.3

## Recent versions

- 0.0.1-beta.2 (latest) — 2018-09-10
- 0.0.1-beta.1 — 2018-08-24
- 0.0.1 — 2018-08-24

## README

# vuex-class-persist

Note: this project is a wrapper around Vuex-Persist and is not intended to steal any of ChampionSwimmer's code.

[Link to Vuex-Persist](https://github.com/championswimmer/vuex-persist)

## Features

* All features found in Vuex-Persist
* Ability to persist instances of classes in localStorage

## Usage

The usage and creation is all the same as vuex-persist, except you also pass along an array of your classes so vuex-class-persist knows which classes to restore back to after the state has been reloaded from storage.

### Steps

Import it
```js
import VuexClassPersistence from 'vuex-class-persist'
```

Create an object

```js
// You will need to be able to supply an array of your classes
// to ensure they get restored from storage.
const classes = [
  class User { /* Omitted */ },
  class Profile { /* Omitted */ },
  class Example { /* Omitted */ },
  ...
]

const vuexLocal = new VuexClassPersistence({
    storage: window.localStorage
}, classes)
```

Use it as Vue plugin. (in typescript)

```typescript
const store = new Vuex.Store<State>({
  state: { ... },
  mutations: { ... },
  actions: { ... },
  plugins: [vuexLocal.plugin]
})
```

(or in Javascript)
```js
const store = {
  state: { ... },
  mutations: { ... },
  actions: { ... },
  plugins: [vuexLocal.plugin]
}
```

---
_Source: https://npm.io/package/vuex-class-persist · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
