Skip to content

Commit

Permalink
realese: v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsn committed Apr 19, 2020
1 parent 0fb54ae commit fa1ccde
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 13 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# [3.2.0](https://github.com/vuejs/vuex/compare/v3.1.3...v3.2.0) (2020-04-19)


### Features

* add Store#hasModule(path) API ([#834](https://github.com/vuejs/vuex/issues/834)) ([d65d142](https://github.com/vuejs/vuex/commit/d65d14276e87aca17cfbd3fbf4af9e8dbb808f24))



## [3.1.3](https://github.com/vuejs/vuex/compare/v3.1.2...v3.1.3) (2020-03-09)


Expand Down
25 changes: 23 additions & 2 deletions dist/vuex.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vuex v3.1.3
* vuex v3.2.0
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -129,6 +129,10 @@ Module.prototype.getChild = function getChild (key) {
return this._children[key]
};

Module.prototype.hasChild = function hasChild (key) {
return key in this._children
};

Module.prototype.update = function update (rawModule) {
this._rawModule.namespaced = rawModule.namespaced;
if (rawModule.actions) {
Expand Down Expand Up @@ -221,6 +225,13 @@ ModuleCollection.prototype.unregister = function unregister (path) {
parent.removeChild(key);
};

ModuleCollection.prototype.isRegistered = function isRegistered (path) {
var parent = this.get(path.slice(0, -1));
var key = path[path.length - 1];

return parent.hasChild(key)
};

function update (path, targetModule, newModule) {
if (process.env.NODE_ENV !== 'production') {
assertRawModule(path, newModule);
Expand Down Expand Up @@ -517,6 +528,16 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
resetStore(this);
};

Store.prototype.hasModule = function hasModule (path) {
if (typeof path === 'string') { path = [path]; }

if (process.env.NODE_ENV !== 'production') {
assert(Array.isArray(path), "module path must be a string or an Array.");
}

return this._modules.isRegistered(path)
};

Store.prototype.hotUpdate = function hotUpdate (newOptions) {
this._modules.update(newOptions);
resetStore(this, true);
Expand Down Expand Up @@ -1041,7 +1062,7 @@ function getModuleByNamespace (store, helper, namespace) {
var index = {
Store: Store,
install: install,
version: '3.1.3',
version: '3.2.0',
mapState: mapState,
mapMutations: mapMutations,
mapGetters: mapGetters,
Expand Down
25 changes: 23 additions & 2 deletions dist/vuex.esm.browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vuex v3.1.3
* vuex v3.2.0
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -124,6 +124,10 @@ class Module {
return this._children[key]
}

hasChild (key) {
return key in this._children
}

update (rawModule) {
this._rawModule.namespaced = rawModule.namespaced;
if (rawModule.actions) {
Expand Down Expand Up @@ -212,6 +216,13 @@ class ModuleCollection {

parent.removeChild(key);
}

isRegistered (path) {
const parent = this.get(path.slice(0, -1));
const key = path[path.length - 1];

return parent.hasChild(key)
}
}

function update (path, targetModule, newModule) {
Expand Down Expand Up @@ -495,6 +506,16 @@ class Store {
resetStore(this);
}

hasModule (path) {
if (typeof path === 'string') path = [path];

{
assert(Array.isArray(path), `module path must be a string or an Array.`);
}

return this._modules.isRegistered(path)
}

hotUpdate (newOptions) {
this._modules.update(newOptions);
resetStore(this, true);
Expand Down Expand Up @@ -998,7 +1019,7 @@ function getModuleByNamespace (store, helper, namespace) {
var index_esm = {
Store,
install,
version: '3.1.3',
version: '3.2.0',
mapState,
mapMutations,
mapGetters,
Expand Down
4 changes: 2 additions & 2 deletions dist/vuex.esm.browser.min.js

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions dist/vuex.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vuex v3.1.3
* vuex v3.2.0
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -127,6 +127,10 @@ Module.prototype.getChild = function getChild (key) {
return this._children[key]
};

Module.prototype.hasChild = function hasChild (key) {
return key in this._children
};

Module.prototype.update = function update (rawModule) {
this._rawModule.namespaced = rawModule.namespaced;
if (rawModule.actions) {
Expand Down Expand Up @@ -219,6 +223,13 @@ ModuleCollection.prototype.unregister = function unregister (path) {
parent.removeChild(key);
};

ModuleCollection.prototype.isRegistered = function isRegistered (path) {
var parent = this.get(path.slice(0, -1));
var key = path[path.length - 1];

return parent.hasChild(key)
};

function update (path, targetModule, newModule) {
if (process.env.NODE_ENV !== 'production') {
assertRawModule(path, newModule);
Expand Down Expand Up @@ -515,6 +526,16 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
resetStore(this);
};

Store.prototype.hasModule = function hasModule (path) {
if (typeof path === 'string') { path = [path]; }

if (process.env.NODE_ENV !== 'production') {
assert(Array.isArray(path), "module path must be a string or an Array.");
}

return this._modules.isRegistered(path)
};

Store.prototype.hotUpdate = function hotUpdate (newOptions) {
this._modules.update(newOptions);
resetStore(this, true);
Expand Down Expand Up @@ -1039,7 +1060,7 @@ function getModuleByNamespace (store, helper, namespace) {
var index_esm = {
Store: Store,
install: install,
version: '3.1.3',
version: '3.2.0',
mapState: mapState,
mapMutations: mapMutations,
mapGetters: mapGetters,
Expand Down
25 changes: 23 additions & 2 deletions dist/vuex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vuex v3.1.3
* vuex v3.2.0
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -133,6 +133,10 @@
return this._children[key]
};

Module.prototype.hasChild = function hasChild (key) {
return key in this._children
};

Module.prototype.update = function update (rawModule) {
this._rawModule.namespaced = rawModule.namespaced;
if (rawModule.actions) {
Expand Down Expand Up @@ -225,6 +229,13 @@
parent.removeChild(key);
};

ModuleCollection.prototype.isRegistered = function isRegistered (path) {
var parent = this.get(path.slice(0, -1));
var key = path[path.length - 1];

return parent.hasChild(key)
};

function update (path, targetModule, newModule) {
{
assertRawModule(path, newModule);
Expand Down Expand Up @@ -520,6 +531,16 @@
resetStore(this);
};

Store.prototype.hasModule = function hasModule (path) {
if (typeof path === 'string') { path = [path]; }

{
assert(Array.isArray(path), "module path must be a string or an Array.");
}

return this._modules.isRegistered(path)
};

Store.prototype.hotUpdate = function hotUpdate (newOptions) {
this._modules.update(newOptions);
resetStore(this, true);
Expand Down Expand Up @@ -1044,7 +1065,7 @@
var index = {
Store: Store,
install: install,
version: '3.1.3',
version: '3.2.0',
mapState: mapState,
mapMutations: mapMutations,
mapGetters: mapGetters,
Expand Down
4 changes: 2 additions & 2 deletions dist/vuex.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuex",
"version": "3.1.3",
"version": "3.2.0",
"description": "state management for Vue.js",
"main": "dist/vuex.common.js",
"module": "dist/vuex.esm.js",
Expand Down

0 comments on commit fa1ccde

Please sign in to comment.