0.0.6 • Published 6 years ago

vuex-persisted-shared-state v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

vuex-persisted-shared-state

Persist Vuex state with localStorage and share between tabs.

Requirements

Installation

$ npm install vuex-persisted-shared-state

or

$ yarn add vuex-persisted-shared-state

Usage

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

{
    'cart': 'SET_CART',
}

or like an objects

{
    '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')
0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago