@@ -30,8 +30,8 @@ class Store {
30
30
this . dispatch = function boundDispatch ( type , payload ) {
31
31
return dispatch . call ( store , type , payload )
32
32
}
33
- this . commit = function boundCommit ( type , payload ) {
34
- return commit . call ( store , type , payload )
33
+ this . commit = function boundCommit ( type , payload , options ) {
34
+ return commit . call ( store , type , payload , options )
35
35
}
36
36
37
37
// strict mode
@@ -58,10 +58,11 @@ class Store {
58
58
assert ( false , `Use store.replaceState() to explicit replace store state.` )
59
59
}
60
60
61
- commit ( type , payload ) {
61
+ commit ( type , payload , options ) {
62
62
// check object-style commit
63
63
let mutation
64
64
if ( isObject ( type ) && type . type ) {
65
+ options = payload
65
66
payload = mutation = type
66
67
type = type . type
67
68
} else {
@@ -77,7 +78,7 @@ class Store {
77
78
handler ( payload )
78
79
} )
79
80
} )
80
- if ( ! payload || ! payload . silent ) {
81
+ if ( ! options || ! options . silent ) {
81
82
this . _subscribers . forEach ( sub => sub ( mutation , this . state ) )
82
83
}
83
84
}
0 commit comments