Skip to content

Instantly share code, notes, and snippets.

@IgorHalfeld
Created March 25, 2019 14:53
Show Gist options
  • Save IgorHalfeld/3fe03fb73ea9b72ab405080583eafff1 to your computer and use it in GitHub Desktop.
Save IgorHalfeld/3fe03fb73ea9b72ab405080583eafff1 to your computer and use it in GitHub Desktop.
function createStore({ state, mutations }) {
return {
state: Vue.observable(state),
commit(key, ...args) {
mutations[key](state, ...args)
}
}
}
const store = createStore({
state: { count: 0 },
mutations: {
inc (state) {
state.count++
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment