Socket
Socket
Sign inDemoInstall

vuex-persisted-shared-state

Package Overview
Dependencies
11
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vuex-persisted-shared-state

Persist Vuex state with localStorage and share between tabs.


Version published
Maintainers
2
Install size
6.97 kB
Created

Readme

Source

vuex-persisted-shared-state

Persist Vuex state with localStorage and share between tabs.

Requirements

  • Vue.js (v2.0.0+)
  • Vuex (v2.0.0+)

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

Keywords

FAQs

Last updated on 16 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc