Skip to content

Commit

Permalink
feat(store): bind mutation and action handlers to store (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored and yyx990803 committed Jul 19, 2017
1 parent fd2b188 commit 67da622
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,14 @@ function makeLocalGetters (store, namespace) {
function registerMutation (store, type, handler, local) {
const entry = store._mutations[type] || (store._mutations[type] = [])
entry.push(function wrappedMutationHandler (payload) {
handler(local.state, payload)
handler.call(store, local.state, payload)
})
}

function registerAction (store, type, handler, local) {
const entry = store._actions[type] || (store._actions[type] = [])
entry.push(function wrappedActionHandler (payload, cb) {
let res = handler({
let res = handler.call(store, {
dispatch: local.dispatch,
commit: local.commit,
getters: local.getters,
Expand Down

0 comments on commit 67da622

Please sign in to comment.