Skip to content

zhaosaisai/eventx

Repository files navigation

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!

About

The core implementation of vuex

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published