(_type, _payload, _options)
| 93 | } |
| 94 | |
| 95 | commit (_type, _payload, _options) { |
| 96 | // check object-style commit |
| 97 | const { |
| 98 | type, |
| 99 | payload, |
| 100 | options |
| 101 | } = unifyObjectStyle(_type, _payload, _options) |
| 102 | |
| 103 | const mutation = { type, payload } |
| 104 | const entry = this._mutations[type] |
| 105 | if (!entry) { |
| 106 | if (__DEV__) { |
| 107 | console.error(`[vuex] unknown mutation type: ${type}`) |
| 108 | } |
| 109 | return |
| 110 | } |
| 111 | this._withCommit(() => { |
| 112 | entry.forEach(function commitIterator (handler) { |
| 113 | handler(payload) |
| 114 | }) |
| 115 | }) |
| 116 | |
| 117 | this._subscribers |
| 118 | .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe |
| 119 | .forEach(sub => sub(mutation, this.state)) |
| 120 | |
| 121 | if ( |
| 122 | __DEV__ && |
| 123 | options && options.silent |
| 124 | ) { |
| 125 | console.warn( |
| 126 | `[vuex] mutation type: ${type}. Silent option has been removed. ` + |
| 127 | 'Use the filter functionality in the vue-devtools' |
| 128 | ) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | dispatch (_type, _payload) { |
| 133 | // check object-style dispatch |
no test coverage detected