# vuex-persisted-shared-state

> Persist Vuex state with localStorage and share between tabs.

Latest version **0.0.6** (published 2018-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install vuex-persisted-shared-state
pnpm add vuex-persisted-shared-state
yarn add vuex-persisted-shared-state
bun add vuex-persisted-shared-state
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2018-07-16 |
| First published | 2018-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Websecret |
| Maintainers | blax, max-websecret |
| Keywords | vue, vuex, localStorage, plugin |

## Links

- npm: https://www.npmjs.com/package/vuex-persisted-shared-state
- Repository: https://github.com/websecret/vuex-persisted-shared-state
- Homepage: https://github.com/websecret/vuex-persisted-shared-state#readme
- Issues: https://github.com/websecret/vuex-persisted-shared-state/issues
- npm.io page: https://npm.io/package/vuex-persisted-shared-state

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2018-07-16
- 0.0.5 — 2018-07-16
- 0.0.4 — 2018-07-16
- 0.0.3 — 2018-07-15
- 0.0.2 — 2018-07-15
- 0.0.1 — 2018-07-15

## README

# vuex-persisted-shared-state
Persist [Vuex](http://vuex.vuejs.org/) state with [localStorage](https://developer.mozilla.org/nl/docs/Web/API/Window/localStorage) and share between tabs.

## Requirements

* [Vue.js](https://vuejs.org) (v2.0.0+)
* [Vuex](http://vuex.vuejs.org) (v2.0.0+)

## Installation

```bash
$ npm install vuex-persisted-shared-state
```
or
```bash
$ yarn add vuex-persisted-shared-state
```


## Usage

```js
import persistedSharedState from "vuex-persisted-shared-state";

const store = new Vuex.Store({
    // ...
    plugins: [
        persistedSharedState({
            'cart': 'SET_CART',
        }),
    ]
});
```

## API

### `persistedSharedState(mutations, options = {})`

Creates a new instance of the plugin with the given mutations object and options.

Mutations can be provided like strings

```js
{
    'cart': 'SET_CART',
}
```

or like an objects

```js
{
    'cart': {
        mutation: 'SET_CART',
        share: false,
        defaultValue: null,
    },
}
```

The following options can be provided to configure the plugin for your specific needs:

* `share`: Should state change be shared between browser tabs. (default: **true**)
* `prefix`: Prefix of the localStorage keys. (default: **'vuex-persisted-shared-state'**)

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