Skip to content

Commit 05e3942

Browse files
committed
[build] 2.0.0-rc.5
1 parent b3ba637 commit 05e3942

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

dist/vuex.js

+14-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vuex v2.0.0-rc.4
2+
* vuex v2.0.0-rc.5
33
* (c) 2016 Evan You
44
* @license MIT
55
*/
@@ -154,7 +154,7 @@
154154
this._wrappedGetters = Object.create(null)
155155
this._runtimeModules = Object.create(null)
156156
this._subscribers = []
157-
this._pendingActions = []
157+
this._watcherVM = new Vue()
158158

159159
// bind commit and dispatch to self
160160
var store = this
@@ -164,8 +164,8 @@
164164
this.dispatch = function boundDispatch (type, payload) {
165165
return dispatch.call(store, type, payload)
166166
}
167-
this.commit = function boundCommit (type, payload) {
168-
return commit.call(store, type, payload)
167+
this.commit = function boundCommit (type, payload, options) {
168+
return commit.call(store, type, payload, options)
169169
}
170170

171171
// strict mode
@@ -194,12 +194,13 @@
194194
assert(false, "Use store.replaceState() to explicit replace store state.")
195195
};
196196

197-
Store.prototype.commit = function commit (type, payload) {
197+
Store.prototype.commit = function commit (type, payload, options) {
198198
var this$1 = this;
199199

200200
// check object-style commit
201201
var mutation
202202
if (isObject(type) && type.type) {
203+
options = payload
203204
payload = mutation = type
204205
type = type.type
205206
} else {
@@ -215,7 +216,7 @@
215216
handler(payload)
216217
})
217218
})
218-
if (!payload || !payload.silent) {
219+
if (!options || !options.silent) {
219220
this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); })
220221
}
221222
};
@@ -226,15 +227,9 @@
226227
console.error(("[vuex] unknown action type: " + type))
227228
return
228229
}
229-
var res = entry.length > 1
230+
return entry.length > 1
230231
? Promise.all(entry.map(function (handler) { return handler(payload); }))
231232
: entry[0](payload)
232-
var pending = this._pendingActions
233-
pending.push(res)
234-
return res.then(function (value) {
235-
pending.splice(pending.indexOf(res), 1)
236-
return value
237-
})
238233
};
239234

240235
Store.prototype.subscribe = function subscribe (fn) {
@@ -254,7 +249,7 @@
254249
var this$1 = this;
255250

256251
assert(typeof getter === 'function', "store.watch only accepts a function.")
257-
return this._vm.$watch(function () { return getter(this$1.state); }, cb, options)
252+
return this._watcherVM.$watch(function () { return getter(this$1.state); }, cb, options)
258253
};
259254

260255
Store.prototype.replaceState = function replaceState (state) {
@@ -271,8 +266,8 @@
271266
this._runtimeModules[path.join('.')] = module
272267
installModule(this, this.state, path, module)
273268
// reset store to update getters...
274-
resetStoreVM(this, this.state)
275-
};
269+
resetStoreVM(this, this.state)
270+
};
276271

277272
Store.prototype.unregisterModule = function unregisterModule (path) {
278273
var this$1 = this;
@@ -297,22 +292,18 @@
297292
}
298293
if (newOptions.getters) {
299294
options.getters = newOptions.getters
300-
}
301-
if (newOptions.modules) {
295+
}
296+
if (newOptions.modules) {
302297
for (var key in newOptions.modules) {
303298
options.modules[key] = newOptions.modules[key]
304299
}
305300
}
306301
resetStore(this)
307302
};
308303

309-
Store.prototype.onActionsResolved = function onActionsResolved (cb) {
310-
Promise.all(this._pendingActions).then(cb)
311-
};
312-
313304
Store.prototype._withCommit = function _withCommit (fn) {
314305
var committing = this._committing
315-
this._committing = true
306+
this._committing = true
316307
fn()
317308
this._committing = committing
318309
};

dist/vuex.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)