Skip to content

Commit

Permalink
[build] 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 8, 2019
1 parent d7c7f98 commit cf09063
Show file tree
Hide file tree
Showing 6 changed files with 1,028 additions and 20 deletions.
23 changes: 17 additions & 6 deletions dist/vuex.common.js
@@ -1,5 +1,5 @@
/**
* vuex v3.1.0
* vuex v3.1.1
* (c) 2019 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -41,9 +41,12 @@ function applyMixin (Vue) {
}
}

var devtoolHook =
typeof window !== 'undefined' &&
window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
var target = typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {};
var devtoolHook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__;

function devtoolPlugin (store) {
if (!devtoolHook) { return }
Expand Down Expand Up @@ -89,6 +92,12 @@ function assert (condition, msg) {
if (!condition) { throw new Error(("[vuex] " + msg)) }
}

function partial (fn, arg) {
return function () {
return fn(arg)
}
}

// Base data struct for store's module, package with some attribute and method
var Module = function Module (rawModule, runtime) {
this.runtime = runtime;
Expand Down Expand Up @@ -550,7 +559,9 @@ function resetStoreVM (store, state, hot) {
var computed = {};
forEachValue(wrappedGetters, function (fn, key) {
// use computed to leverage its lazy-caching mechanism
computed[key] = function () { return fn(store); };
// direct inline function use will lead to closure preserving oldVm.
// using partial to return function with only arguments preserved in closure enviroment.
computed[key] = partial(fn, store);
Object.defineProperty(store.getters, key, {
get: function () { return store._vm[key]; },
enumerable: true // for local getters
Expand Down Expand Up @@ -989,7 +1000,7 @@ function getModuleByNamespace (store, helper, namespace) {
var index = {
Store: Store,
install: install,
version: '3.1.0',
version: '3.1.1',
mapState: mapState,
mapMutations: mapMutations,
mapGetters: mapGetters,
Expand Down

0 comments on commit cf09063

Please sign in to comment.