Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vuex
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.6.2
Choose a base ref
...
head repository: vuejs/vuex
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.6.3
Choose a head ref

Commits on Mar 8, 2016

  1. fix docs link

    yyx990803 committed Mar 8, 2016
    Copy the full SHA
    01dec6e View commit details

Commits on Mar 9, 2016

  1. use node 5 on CI

    yyx990803 committed Mar 9, 2016
    Copy the full SHA
    dd2499e View commit details
  2. Copy the full SHA
    1ab2c81 View commit details

Commits on Mar 10, 2016

  1. Copy the full SHA
    9bcdb9c View commit details

Commits on Mar 13, 2016

  1. Copy the full SHA
    064fb14 View commit details
  2. comments

    yyx990803 committed Mar 13, 2016
    Copy the full SHA
    d1cb234 View commit details

Commits on Mar 18, 2016

  1. 加入快速开始文档

    加入快速开始文档
    基于英文文档 v0.6.2
    hq5544 committed Mar 18, 2016
    Copy the full SHA
    04fd0ec View commit details
  2. 加入快速开始索引

    加入快速开始索引
    hq5544 committed Mar 18, 2016
    Copy the full SHA
    7fda886 View commit details
  3. Merge pull request #102 from hq5544/patch-1

    加入快速开始文档
    yyx990803 committed Mar 18, 2016
    Copy the full SHA
    ebde8ba View commit details
  4. Merge pull request #103 from hq5544/patch-2

    加入快速开始索引
    yyx990803 committed Mar 18, 2016
    Copy the full SHA
    2502cc7 View commit details
  5. 更新了 state 文档

    更新了 state 文档
    基于英文文档 v0.6.2
    hq5544 committed Mar 18, 2016
    Copy the full SHA
    b28acd7 View commit details
  6. 加入对象风格参数

    加入对象风格参数
    基于英文文档 v0.6.2
    hq5544 committed Mar 18, 2016
    Copy the full SHA
    870a0a2 View commit details
  7. Update mutations.md

    hq5544 committed Mar 18, 2016
    Copy the full SHA
    1ac16a9 View commit details
  8. Merge pull request #105 from hq5544/patch-3

    更新了 state 文档
    yyx990803 committed Mar 18, 2016
    Copy the full SHA
    1fcf2b5 View commit details
  9. Merge pull request #106 from hq5544/patch-4

    加入对象风格参数
    yyx990803 committed Mar 18, 2016
    Copy the full SHA
    6738f59 View commit details

Commits on Mar 20, 2016

  1. Update middlewares.md

    Add optional store parameter to onInit and onMutation with short description.
    perkola committed Mar 20, 2016
    Copy the full SHA
    d61dcbb View commit details
  2. Merge pull request #108 from perkola/patch-1

    Update middlewares.md
    yyx990803 committed Mar 20, 2016
    Copy the full SHA
    2f59a23 View commit details

Commits on Mar 21, 2016

  1. 修正mutation内操作state的行为

    没记错的话,state应该是整个state
    yanni4night committed Mar 21, 2016
    Copy the full SHA
    b5dfbd9 View commit details
  2. Merge pull request #110 from yanni4night/patch-1

    修正mutation内操作state的行为
    yyx990803 committed Mar 21, 2016
    Copy the full SHA
    082e319 View commit details
  3. Copy the full SHA
    b57e84b View commit details

Commits on Mar 22, 2016

  1. Copy the full SHA
    d5737d2 View commit details

Commits on Mar 24, 2016

  1. update testing.md's translation

    update testing.md's translation according to latest vuex versoin(0.6.2).
    ryerh committed Mar 24, 2016
    Copy the full SHA
    19199dc View commit details
  2. Copy the full SHA
    e1d56da View commit details
  3. Merge pull request #118 from billcolumbia/update-docs-getting-started

    Update store with default export to match later docs and examples
    yyx990803 committed Mar 24, 2016
    Copy the full SHA
    55ac7d8 View commit details
  4. Merge pull request #111 from skyronic/tutorial

    Vuex Tutorial
    yyx990803 committed Mar 24, 2016
    Copy the full SHA
    743ad19 View commit details
  5. Merge pull request #116 from ryerh/ryerh-translation-patch

    update testing.md's translation
    yyx990803 committed Mar 24, 2016
    Copy the full SHA
    3208973 View commit details

Commits on Mar 25, 2016

  1. update apimd's doc

    Yan.Huang committed Mar 25, 2016
    Copy the full SHA
    4a332b8 View commit details
  2. correct words

    Yan.Huang committed Mar 25, 2016
    Copy the full SHA
    c348c68 View commit details
  3. Merge pull request #120 from ryerh/zh-cn-docs-patch

    zh-cn docs patch
    yyx990803 committed Mar 25, 2016
    Copy the full SHA
    9071ec3 View commit details

Commits on Mar 26, 2016

  1. update actions.md's translation

    Yan.Huang committed Mar 26, 2016
    Copy the full SHA
    8f2b747 View commit details
  2. revise article

    Yan.Huang committed Mar 26, 2016
    Copy the full SHA
    6d2e0ec View commit details
  3. Update quickstart.md

    think2011 committed Mar 26, 2016
    Copy the full SHA
    fd5eed8 View commit details
  4. Merge pull request #123 from think2011/patch-1

    Update quickstart.md
    yyx990803 committed Mar 26, 2016
    Copy the full SHA
    b4aa761 View commit details

Commits on Mar 27, 2016

  1. 必须避免副作用 -> 应当尽量避免副作用

    Yan.Huang committed Mar 27, 2016
    Copy the full SHA
    cf34af4 View commit details
  2. update state.md's translation

    Yan.Huang committed Mar 27, 2016
    Copy the full SHA
    71edb21 View commit details
  3. Merge pull request #122 from ryerh/zh-cn-docs-patch

    zh-cn-docs-patch
    yyx990803 committed Mar 27, 2016
    Copy the full SHA
    5be7786 View commit details
  4. correct words

    Yan.Huang committed Mar 27, 2016
    Copy the full SHA
    ed7dfb8 View commit details
  5. Merge pull request #124 from ryerh/zh-cn-docs-patch

    zh-cn-docs-patch
    yyx990803 committed Mar 27, 2016
    Copy the full SHA
    b2e9f27 View commit details
  6. add one important missing line

    Yan.Huang committed Mar 27, 2016
    Copy the full SHA
    4313bdf View commit details
  7. Merge pull request #125 from ryerh/zh-cn-docs-patch

    add one important missing line
    yyx990803 committed Mar 27, 2016
    Copy the full SHA
    a9c6aaa View commit details

Commits on Mar 28, 2016

  1. Add Portuguese Translation

    Finalizando primeira versão da tradução. Falta uma revisão/melhorias nos exemplos
    
    Update docs/pt/SUMMARY.md
    
    Update docs/pt/intro.md
    
    Update docs/pt/getting-started.md
    
    Update docs/pt/getting-started.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/state.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/mutations.md
    
    Update docs/pt/actions.md
    
    Update docs/pt/actions.md
    
    Update docs/pt/actions.md
    
    Update docs/pt/actions.md
    
    Update docs/pt/actions.md
    
    Update docs/pt/structure.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/middlewares.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/strict.md
    
    Update docs/pt/forms.md
    
    Update docs/pt/forms.md
    
    Update docs/pt/forms.md
    
    Update docs/pt/forms.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/testing.md
    
    Update docs/pt/hot-reload.md
    
    Update docs/pt/hot-reload.md
    
    Update docs/pt/hot-reload.md
    
    Update docs/pt/hot-reload.md
    
    Update docs/pt/hot-reload.md
    
    Update docs/pt/api.md
    
    Update docs/pt/api.md
    
    Update docs/pt/api.md
    
    Update docs/pt/api.md
    
    Update docs/pt/api.md
    
    Revisão da tradução realizada!
    vitorarjol committed Mar 28, 2016
    Copy the full SHA
    a918715 View commit details
  2. Merge pull request #126 from vitorarjol/master

    Adding Portuguese Translation for Vuex
    yyx990803 committed Mar 28, 2016
    Copy the full SHA
    ba9bada View commit details
  3. Copy the full SHA
    8e43263 View commit details

Commits on Mar 30, 2016

  1. update translation of data-flow.md

    Yan.Huang committed Mar 30, 2016
    Copy the full SHA
    d078f80 View commit details
  2. Merge pull request #128 from ryerh/zh-cn-docs-patch

    update translation of data-flow.md
    yyx990803 committed Mar 30, 2016
    Copy the full SHA
    f01c9e9 View commit details
  3. Typo fix at tutorial.md

    jbruni committed Mar 30, 2016
    Copy the full SHA
    d5ba9f1 View commit details

Commits on Mar 31, 2016

  1. Merge pull request #129 from jbruni/patch-6

    Typo fix at tutorial.md
    yyx990803 committed Mar 31, 2016
    Copy the full SHA
    5e0b247 View commit details

Commits on Apr 6, 2016

  1. Copy the full SHA
    bfa81db View commit details

Commits on Apr 8, 2016

  1. Better user error. (#134)

    * Better user error.
    
    * Simplify function check and use console.warn.
    
    * Warn user when trying to set non function as vuex action.
    zigomir authored and yyx990803 committed Apr 8, 2016
    Copy the full SHA
    e1940c0 View commit details
  2. Added Italian Translation (#117)

    * Added Italian Translation
    
    * Fixed link
    
    * Translated State documentation
    
    * Translated state
    
    * Translated Mutations
    
    * Improved translation
    
    * Finished Action translation
    
    * Finished Data Flow translation
    
    * Translated structure
    
    * Fixed wrong link
    
    * Translated middlewares
    
    * Improved translation
    
    * Translated strict
    
    * Translated forms
    
    * Translated Hot Reload
    
    * Translated API
    
    * Started last translation
    
    * Translate Testing. The translation is complete
    ludo237 authored and yyx990803 committed Apr 8, 2016

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    e4dd092 View commit details
Showing with 3,763 additions and 299 deletions.
  1. +2 −2 README.md
  2. +1 −1 circle.yml
  3. +99 −41 dist/vuex.js
  4. +2 −2 dist/vuex.min.js
  5. +2 −0 docs/LANGS.md
  6. +1 −0 docs/en/SUMMARY.md
  7. +32 −1 docs/en/api.md
  8. +10 −1 docs/en/getting-started.md
  9. +5 −5 docs/en/middlewares.md
  10. +54 −0 docs/en/mutations.md
  11. +2 −2 docs/en/state.md
  12. +266 −0 docs/en/tutorial.md
  13. BIN docs/en/tutorial/result.png
  14. BIN docs/en/tutorial/vuex_flow.png
  15. +1 −0 docs/it/README.md
  16. +18 −0 docs/it/SUMMARY.md
  17. +133 −0 docs/it/actions.md
  18. +94 −0 docs/it/api.md
  19. +1 −0 docs/it/book.json
  20. +89 −0 docs/it/data-flow.md
  21. +41 −0 docs/it/forms.md
  22. +54 −0 docs/it/getting-started.md
  23. +45 −0 docs/it/hot-reload.md
  24. +13 −0 docs/it/intro.md
  25. +83 −0 docs/it/middlewares.md
  26. +135 −0 docs/it/mutations.md
  27. +159 −0 docs/it/state.md
  28. +25 −0 docs/it/strict.md
  29. +136 −0 docs/it/structure.md
  30. +166 −0 docs/it/testing.md
  31. BIN docs/it/vuex.png
  32. +1 −0 docs/pt/README.md
  33. +19 −0 docs/pt/SUMMARY.md
  34. +134 −0 docs/pt/actions.md
  35. +94 −0 docs/pt/api.md
  36. +1 −0 docs/pt/book.json
  37. +89 −0 docs/pt/data-flow.md
  38. +41 −0 docs/pt/forms.md
  39. +53 −0 docs/pt/getting-started.md
  40. +44 −0 docs/pt/hot-reload.md
  41. +13 −0 docs/pt/intro.md
  42. +82 −0 docs/pt/middlewares.md
  43. +134 −0 docs/pt/mutations.md
  44. +156 −0 docs/pt/state.md
  45. +25 −0 docs/pt/strict.md
  46. +136 −0 docs/pt/structure.md
  47. +167 −0 docs/pt/testing.md
  48. +266 −0 docs/pt/tutorial.md
  49. BIN docs/pt/tutorial/result.png
  50. BIN docs/pt/tutorial/vuex_flow.png
  51. BIN docs/pt/vuex.png
  52. +1 −0 docs/zh-cn/SUMMARY.md
  53. +90 −91 docs/zh-cn/actions.md
  54. +27 −26 docs/zh-cn/api.md
  55. +34 −38 docs/zh-cn/data-flow.md
  56. +40 −3 docs/zh-cn/mutations.md
  57. +52 −1 docs/zh-cn/quickstart.md
  58. +126 −22 docs/zh-cn/state.md
  59. +55 −29 docs/zh-cn/testing.md
  60. +20 −0 index.d.ts
  61. +3 −1 package.json
  62. +38 −21 src/index.js
  63. +51 −8 src/override.js
  64. +90 −4 test/unit/test.js
  65. +12 −0 tsconfig.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
<img width="700px" src="https://raw.githubusercontent.com/vuejs/vuex/master/docs/en/vuex.png">
</p>

- [Documentation](http://vuex.vuejs.org/)
- [Documentation](http://vuejs.github.io/vuex/)
- [Great introduction and explanation by @skyronic](http://skyronic.com/2016/01/03/vuex-basics-tutorial/) (using outdated 0.3.0 API, but still worth a read!)
- [Vuex introduction video - James Browne from London Vue.js Meetup #1](https://www.youtube.com/watch?v=l1KHL-TX3qs)

@@ -34,4 +34,4 @@ See [npm scripts](https://github.com/vuejs/vuex/blob/master/package.json#L11-L15
- Reactive
- Single State Tree
- Hot Reloading
- Time Travel (with upcoming vue-devtools support)
- Time Travel (with [vue-devtools](https://github.com/vuejs/vue-devtools) support)
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
machine:
node:
version: 4
version: 5
140 changes: 99 additions & 41 deletions dist/vuex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Vuex v0.6.2
* Vuex v0.6.3
* (c) 2016 Evan You
* Released under the MIT License.
*/
@@ -158,6 +158,10 @@
_init.call(this, options);
};

/**
* Vuex init hook, injected into each instances init hooks list.
*/

function vuexInit() {
var options = this.$options;
var store = options.store;
@@ -194,27 +198,55 @@
if (actions) {
options.methods = options.methods || {};
for (var _key in actions) {
options.methods[_key] = makeBoundAction(actions[_key], this.$store);
options.methods[_key] = makeBoundAction(this.$store, actions[_key], _key);
}
}
}
}

/**
* Setter for all getter properties.
*/

function setter() {
throw new Error('vuex getter properties are read-only.');
}

/**
* Define a Vuex getter on an instance.
*
* @param {Vue} vm
* @param {String} key
* @param {Function} getter
*/

function defineVuexGetter(vm, key, getter) {
Object.defineProperty(vm, key, {
enumerable: true,
configurable: true,
get: makeComputedGetter(vm.$store, getter),
set: setter
});
if (typeof getter !== 'function') {
console.warn('[vuex] Getter bound to key \'vuex.getters.' + key + '\' is not a function.');
} else {
Object.defineProperty(vm, key, {
enumerable: true,
configurable: true,
get: makeComputedGetter(vm.$store, getter),
set: setter
});
}
}

/**
* Make a computed getter, using the same caching mechanism of computed
* properties. In addition, it is cached on the raw getter function using
* the store's unique cache id. This makes the same getter shared
* across all components use the same underlying watcher, and makes
* the getter evaluated only once during every flush.
*
* @param {Store} store
* @param {Function} getter
*/

function makeComputedGetter(store, getter) {
var id = store._getterCacheId;

// cached
if (getter[id]) {
return getter[id];
@@ -238,7 +270,18 @@
return computedGetter;
}

function makeBoundAction(action, store) {
/**
* Make a bound-to-store version of a raw action function.
*
* @param {Store} store
* @param {Function} action
* @param {String} key
*/

function makeBoundAction(store, action, key) {
if (typeof action !== 'function') {
console.warn('[vuex] Action bound to key \'vuex.actions.' + key + '\' is not a function.');
}
return function vuexBoundAction() {
for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
args[_key2] = arguments[_key2];
@@ -344,22 +387,19 @@
*/

value: function dispatch(type) {
var _this2 = this;

for (var _len2 = arguments.length, payload = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
payload[_key2 - 1] = arguments[_key2];
}

var silent = false;
// compatibility for object actions, e.g. FSA
if ((typeof type === 'undefined' ? 'undefined' : babelHelpers.typeof(type)) === 'object' && type.type && arguments.length === 1) {
payload = [type];
payload = [type.payload];
if (type.silent) silent = true;
type = type.type;
}
var mutation = this._mutations[type];
var prevSnapshot = this._prevSnapshot;
var state = this.state;
var snapshot = void 0,
clonedPayload = void 0;
if (mutation) {
this._dispatching = true;
// apply the mutation
@@ -371,20 +411,7 @@
mutation.apply(undefined, [state].concat(babelHelpers.toConsumableArray(payload)));
}
this._dispatching = false;
// invoke middlewares
if (this._needSnapshots) {
snapshot = this._prevSnapshot = deepClone(state);
clonedPayload = deepClone(payload);
}
this._middlewares.forEach(function (m) {
if (m.onMutation) {
if (m.snapshot) {
m.onMutation({ type: type, payload: clonedPayload }, snapshot, prevSnapshot, _this2);
} else {
m.onMutation({ type: type, payload: payload }, state, _this2);
}
}
});
if (!silent) this._applyMiddlewares(type, payload);
} else {
console.warn('[vuex] Unknown mutation: ' + type);
}
@@ -403,10 +430,10 @@
}, {
key: 'watch',
value: function watch(expOrFn, cb, options) {
var _this3 = this;
var _this2 = this;

return this._vm.$watch(function () {
return typeof expOrFn === 'function' ? expOrFn(_this3.state) : _this3._vm.$get(expOrFn);
return typeof expOrFn === 'function' ? expOrFn(_this2.state) : _this2._vm.$get(expOrFn);
}, cb, options);
}

@@ -440,10 +467,8 @@
}, {
key: '_setupModuleState',
value: function _setupModuleState(state, modules) {
var setPath = Vue.parsers.path.setPath;

Object.keys(modules).forEach(function (key) {
setPath(state, key, modules[key].state || {});
Vue.set(state, key, modules[key].state || {});
});
}

@@ -458,8 +483,6 @@
key: '_setupModuleMutations',
value: function _setupModuleMutations(updatedModules) {
var modules = this._modules;
var getPath = Vue.parsers.path.getPath;

var allMutations = [this._rootMutations];
Object.keys(updatedModules).forEach(function (key) {
modules[key] = updatedModules[key];
@@ -476,7 +499,7 @@
args[_key3 - 1] = arguments[_key3];
}

original.apply(undefined, [getPath(state, key)].concat(args));
original.apply(undefined, [state[key]].concat(args));
};
});
allMutations.push(mutations);
@@ -496,12 +519,12 @@
}, {
key: '_setupMutationCheck',
value: function _setupMutationCheck() {
var _this4 = this;
var _this3 = this;

var Watcher = getWatcher(this._vm);
/* eslint-disable no-new */
new Watcher(this._vm, '$data', function () {
if (!_this4._dispatching) {
if (!_this3._dispatching) {
throw new Error('[vuex] Do not mutate vuex store state outside mutation handlers.');
}
}, { deep: true, sync: true });
@@ -522,7 +545,7 @@
}, {
key: '_setupMiddlewares',
value: function _setupMiddlewares(middlewares, state) {
var _this5 = this;
var _this4 = this;

this._middlewares = [devtoolMiddleware].concat(middlewares);
this._needSnapshots = middlewares.some(function (m) {
@@ -535,7 +558,38 @@
// call init hooks
this._middlewares.forEach(function (m) {
if (m.onInit) {
m.onInit(m.snapshot ? initialSnapshot : state, _this5);
m.onInit(m.snapshot ? initialSnapshot : state, _this4);
}
});
}

/**
* Apply the middlewares on a given mutation.
*
* @param {String} type
* @param {Array} payload
*/

}, {
key: '_applyMiddlewares',
value: function _applyMiddlewares(type, payload) {
var _this5 = this;

var state = this.state;
var prevSnapshot = this._prevSnapshot;
var snapshot = void 0,
clonedPayload = void 0;
if (this._needSnapshots) {
snapshot = this._prevSnapshot = deepClone(state);
clonedPayload = deepClone(payload);
}
this._middlewares.forEach(function (m) {
if (m.onMutation) {
if (m.snapshot) {
m.onMutation({ type: type, payload: clonedPayload }, snapshot, prevSnapshot, _this5);
} else {
m.onMutation({ type: type, payload: payload }, state, _this5);
}
}
});
}
@@ -552,6 +606,10 @@
}();

function install(_Vue) {
if (Vue) {
console.warn('[vuex] already installed. Vue.use(Vuex) should be called only once.');
return;
}
Vue = _Vue;
override(Vue);
}
Loading