Giter Club home page Giter Club logo

vuex-electron's Introduction

Vuex Electron

Travis Code Climate Code Climate Code Style Prettier Made With Love

The easiest way to share your Vuex Store between all processes (including main).

Features

โญ Persisted state
โญ Shared mutations

Requirements

Installation

Installation of the Vuex Electron easy as 1-2-3.

  1. Install package with using of yarn or npm:

    yarn install vuex-electron
    

    or

    npm install vuex-electron
    
  2. Include plugins in your Vuex store::

    import Vue from "vue"
    import Vuex from "vuex"
    
    import { createPersistedState, createSharedMutations } from "vuex-electron"
    
    Vue.use(Vuex)
    
    export default new Vuex.Store({
      // ...
      plugins: [
        createPersistedState(),
        createSharedMutations()
      ],
      // ...
    })
  3. In case if you enabled createSharedMutations() plugin you need to create an instance of store in the main process. To do it just add this line into your main process (for example src/main.js):

    import './path/to/your/store'
  4. Well done you did it! The last step is to add the star to this repo ๐Ÿ˜„

Usage example: Vuex Electron Example

IMPORTANT

In renderer process to call actions you need to use dispatch or mapActions. Don't use commit because actions fired via commit will not be shared between processes.

Options

Available options for createPersistedState()

createPersistedState({
  whitelist: ["whitelistedMutation", "anotherWhitelistedMutation"],

  // or

  whitelist: (mutation) => {
    return true
  },

  // or

  blacklist: ["ignoredMutation", "anotherIgnoredMutation"],

  // or

  blacklist: (mutation) => {
    return true
  }
})

Author

Andrew Emelianenko
IG: @truemelianenko

License

MIT License

vuex-electron's People

Contributors

akodkod avatar stormtv avatar usagiring avatar paulbernier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.