vuex-localstorage
Version:
:dvd: Persist Vuex state with expires by localStorage or some else storage.
52 lines (36 loc) • 1.52 kB
Markdown
# VUEX-LOCALSTORAGE
> :dvd: Persist Vuex state with expires by localStorage or some else storage.
[](https://travis-ci.org/crossjs/vuex-localstorage)
[](https://coveralls.io/github/crossjs/vuex-localstorage)
[](https://david-dm.org/crossjs/vuex-localstorage)
[](https://david-dm.org/crossjs/vuex-localstorage?type=dev)
[](https://npmjs.org/package/vuex-localstorage)
## Usage
``` js
import { Store } from 'vuex'
import createPersist, { createStorage } from 'vuex-localstorage'
new Store({
plugins: [createPersist({
namespace: 'namespace-for-state'
initialState: {},
// ONE_WEEK
expires: 7 * 24 * 60 * 60 * 1e3
})]
}
```
[Live Example at PLATO](https://github.com/platojs/plato/blob/master/src/modules/persist/index.js)
## Development Setup
``` bash
# install deps
npm install
# build dist files
npm run build
# lint & run all tests
npm test
# run unit tests only
npm run unit
```
## Special Thanks
[vuex-persistedstate](https://github.com/robinvdvleuten/vuex-persistedstate)
## License
[MIT](http://opensource.org/licenses/MIT)