Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 1.13 KB

README.md

File metadata and controls

76 lines (59 loc) · 1.13 KB

Welcome to eventx 👋

License: MIT

The core implementation of vuex

Install

npm install eventx

Usage

Just like vuex

import Vue from 'vue'
import App from './App.vue'
import eventx from 'eventx'

Vue.use(eventx)

const store = new eventx.Store({
  state: {
    name: 'zhaosaisai'
  },
  getters: {
    caplize(state) {
      return state.name.toLocaleUpperCase()
    }
  },
  mutations: {
    updateName(state, payload) {
      state.name = payload
    }
  },
  actions: {
    dispatchName(store, payload) {
      return new Promise(resolve => {
        setTimeout(() => {
          store.state.name = payload
          resolve(payload + 'ssssss')
        }, 3000)
      })
    }
  }
})

new Vue({
  el: '#app',
  render: h => h(App),
  store
})

Run tests

npm run test

Author

👤 zhaosaisai

Show your support

Give a ⭐️ if this project helped you!