Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "vue-flow", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "To make the state of application managed and processed as data flow.", | ||
@@ -5,0 +5,0 @@ "main": "vue-flow.js", |
(function () { | ||
/** | ||
Vue.flow.model() | ||
Vue.flow.addMiddleware() | ||
Vue.flow.mixin() | ||
Vue.flow.bind() | ||
Vue.flow.model() | ||
Vue.flow.addMiddleware() | ||
Vue.flow.mixin() | ||
Vue.flow.bind() | ||
* */ | ||
@@ -54,3 +54,3 @@ | ||
function dispatch(name, obj) { | ||
function dispatch() { | ||
@@ -84,3 +84,3 @@ return run_middlewares(this, Array.prototype.slice.call(arguments), { | ||
return middlewares[index++](dispatch, next, end, meta).apply(model, args); | ||
else if(args[0] && args[0].constructor === Object) return end(args[0]); | ||
else return end(args[0]); | ||
} | ||
@@ -107,3 +107,3 @@ function end(result){ | ||
for (var i = 0, l = pipes.length; i < l; i++) if (pipes) { | ||
for (var i = 0, l = pipes.length; i < l; i++) if (pipes[i]) { | ||
// 第2层根据changedFields判断是否有更新,过滤一把 | ||
@@ -144,3 +144,3 @@ if (pipes[i].statePath[1] && changedFields.indexOf(pipes[i].statePath[1]) === -1) continue; | ||
for (var i = 0, l = hook_beforeStore.length; i < l; i++) { | ||
hook_beforeFlowIn[i](comp, meta); | ||
hook_beforeFlowIn[i].call(comp, meta); | ||
} | ||
@@ -153,3 +153,3 @@ } | ||
if (typeof func === 'function') | ||
switch (hookName) { | ||
switch (bindName) { | ||
case 'beforeStore': | ||
@@ -177,5 +177,5 @@ hook_beforeStore.push(func); | ||
init: function () { | ||
if (this.$options.flow) { | ||
for (var x in this.$options.flow) if (this.$options.flow.hasOwnProperty(x)) { | ||
var statePath = this.$options.flow[x].split('.'); | ||
if (this.$options.pipes) { | ||
for (var x in this.$options.pipes) if (this.$options.pipes.hasOwnProperty(x)) { | ||
var statePath = this.$options.pipes[x].split('.'); | ||
connections[statePath[0]] = connections[statePath[0]] || []; | ||
@@ -193,8 +193,22 @@ connections[statePath[0]].push({ | ||
if(this.$options.action){ | ||
var action; | ||
for (var x in this.$options.action) if (this.$options.action.hasOwnProperty(x)) { | ||
action = this.$options.action[x].split('.'); | ||
if (!models[action[0]]) throw 'the model ' + action[0] + ' is not exist'; | ||
if (!models[action[0]][action[1]]) throw 'the action ' + action[1] + ' of model ' + action[0] + ' is not exist'; | ||
this[x]=(function(modelName,actionName){ | ||
return function(){ | ||
models[modelName][actionName].call(models[modelName], Array.prototype.slice.call(arguments)); | ||
}; | ||
})(action[0], action[1]); | ||
} | ||
} | ||
}, | ||
beforeDestroy: function () { | ||
if (this.$options.flow) { | ||
if (this.$options.pipes) { | ||
var statePath, tmp; | ||
for (var x in this.$options.flow) if (this.$options.flow.hasOwnProperty(x)) { | ||
statePath = this.$options.flow[x].split('.'); | ||
for (var x in this.$options.pipes) if (this.$options.pipes.hasOwnProperty(x)) { | ||
statePath = this.$options.pipes[x].split('.'); | ||
tmp = []; | ||
@@ -273,2 +287,3 @@ for (var i = 0, l = connections[statePath[0]].length; i < l; i++) { | ||
function pathValue(statePath) { | ||
console.log(statePath); | ||
var state = store[statePath[0]]; | ||
@@ -275,0 +290,0 @@ if (!statePath[1]) return clone(state); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
1
9650
2
260
2
0