Comparing version 3.1.3 to 3.1.4
@@ -12,5 +12,5 @@ import Motx, { MotXOptions } from './index'; | ||
constructor(options: MotXOptions); | ||
protected install(Vue: any): void; | ||
install(Vue: any): void; | ||
protected connectState(targetObject: any, propName: any, statePath: any): any; | ||
} | ||
export {}; |
@@ -19,17 +19,15 @@ "use strict"; | ||
_this.connections = {}; | ||
if (options.hooks && options.hooks.didSetState) { | ||
var didSetState_1 = _this.hooks.didSetState; | ||
var connections_1 = _this.connections; | ||
_this.hooks.didSetState = function (fieldName, newState, isolate, store) { | ||
didSetState_1(fieldName, newState, isolate, store); | ||
var cnns = connections_1[fieldName]; | ||
if (cnns && cnns.length) { | ||
for (var i = 0, l = cnns.length; i < l; i++) { | ||
if (cnns[i]) { | ||
cnns[i].comp[cnns[i].propName] = _this.getState(cnns[i].statePath); | ||
} | ||
var didSetState = _this.hooks.didSetState; | ||
var connections = _this.connections; | ||
_this.hooks.didSetState = function (fieldName, newState, isolate, store) { | ||
didSetState(fieldName, newState, isolate, store); | ||
var cnns = connections[fieldName]; | ||
if (cnns && cnns.length) { | ||
for (var i = 0, l = cnns.length; i < l; i++) { | ||
if (cnns[i]) { | ||
cnns[i].comp[cnns[i].propName] = _this.getState(cnns[i].statePath); | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
_this.options = tslib_1.__assign({}, options); | ||
@@ -59,8 +57,11 @@ return _this; | ||
for (var x in stateOption) { | ||
tmp = []; | ||
for (var i = 0, l = connections[stateOption[x]].length; i < l; i++) { | ||
if (connections[stateOption[x]][i].comp !== this) | ||
tmp.push(connections[stateOption[x]][i]); | ||
if (stateOption[x]) { | ||
tmp = []; | ||
for (var i = 0, l = connections[stateOption[x]].length; i < l; i++) { | ||
if (connections[stateOption[x]][i].comp !== this) { | ||
tmp.push(connections[stateOption[x]][i]); | ||
} | ||
} | ||
connections[stateOption[x]] = tmp; | ||
} | ||
connections[stateOption[x]] = tmp; | ||
} | ||
@@ -73,4 +74,5 @@ } | ||
var connections = this.connections; | ||
if (!statePath) | ||
if (!statePath) { | ||
throw '[tunk]:unknown module name:' + statePath; | ||
} | ||
connections[statePath] = connections[statePath] || []; | ||
@@ -82,3 +84,3 @@ connections[statePath].push({ | ||
}); | ||
//返回组件默认数据 | ||
// 返回组件默认数据 | ||
return this.getState(statePath); | ||
@@ -85,0 +87,0 @@ }; |
{ | ||
"name": "motx", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"description": "A lightweight application state transfer and storage tool based on the mediator pattern and provides efficient solutions to communication problems between multiple processes or closed modules", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32822
662