vuex-action-init

0.1.0 • Public • Published

Vuex Action Init (Starting Your State)

Build Status codecov npm npm

Initiate Vuex State and Module State

Motivation

I found to initiate state for a Vuex store and Vuex store module is quite awkard and a solution was needed. The library is designed to initiate the store and modules store in Vuex.

  • add a check for an INIT action
  • When INIT found run before anything else
  • When INIT found in SSR have it load before anything else

Install

npm install vuex-action-init --save

Usage

Use in a Vue App

INIT method is called during load

import Vue from 'vue'
import Vuex from 'vuex'
import App from './App.vue'
import vuexActionInit from 'vuex-action-init'
 
Vue.use(Vuex)
 
const store = new Vuex.Store({
  actions: {
    INIT () {
      console.log('Initalizing')
    }
  },
  plugins: [vuexActionInit()]
})
 
new Vue({
  el: '#app',
  store,
  render: h => h(App)
})

Readme

Keywords

Package Sidebar

Install

npm i vuex-action-init

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

7.14 MB

Total Files

36

Last publish

Collaborators

  • staratarms