Vuex Keg
A container plugin for Vuex\
Using Redux? see redux-keg (working on it)
$ npm i -S vuex-keg
$ yarn add vuex-keg
Vuex Keg plugins
Why Do I Need This?
Vuex context has only {dispatch, commit, state, getters, rootState, rootGetters}
Vuex-keg is a solution to add more your functions for vuex
Why Should I Add More functions?
You may need a function to process repetitive code.
const actions = { ifpayload === 'tree' // do1, do2, ... ifpayload === 'sky' // do1 // ... } { ifpayload === 'tree' // do1, do2, ... ifpayload === 'sky' // do1 }
Why don't you make and add a function for it
const action = ...
How to Register & Use
Vueconst store = state: count: 0 mutation: { statecount += 1 } actions: { } // support single running by the name parameter // no need the name if you think you don't need to use context.name in plugins of Vuex-keg doSayHum: // Now Keg can set many actions at once ... // now Keg can hook before and after the Action is executed [^1.2.1] ... plugins: