Comparing version 0.2.3 to 0.2.4
@@ -81,3 +81,3 @@ (function(e, a) { for(var i in a) e[i] = a[i]; }(this, /******/ (function(modules) { // webpackBootstrap | ||
var root = (0, _factory2['default'])(_consts.DEFAULTS, "flow"); | ||
var root = (0, _factory2['default'])(_consts.DEFAULTS, "flow", []); | ||
_logger2['default'].init(root); | ||
@@ -456,3 +456,3 @@ exports['default'] = root; | ||
loggers.forEach(function (f) { | ||
f.isRemote ? f.logger(remoteLog(flow, name, newData, oldData)) : f.logger(flow, name, newData, oldData); | ||
f.isRemote ? f.logger(remoteLog(flow, name, newData, oldData), flow) : f.logger(flow, name, newData, oldData); | ||
}); | ||
@@ -464,3 +464,3 @@ debug(flow, name, newData, oldData); | ||
function debug(flow, name, newData, oldData) { | ||
global.__nflow_devtools_hook__ && global.__nflow_devtools_hook__(remoteLog(flow, name, newData, oldData)); | ||
global.__nflow_devtools_hook__ && global.__nflow_devtools_hook__(remoteLog(flow, name, newData, oldData), flow); | ||
} | ||
@@ -953,6 +953,6 @@ | ||
flow: flow, | ||
route: arr.slice(0, i + 1).map(function (f) { | ||
route: arr.slice(0, i + 1).map(function (f, i) { | ||
return { | ||
flow: f, | ||
direction: _consts.DIRECTION.CURRENT | ||
direction: i ? _consts.DIRECTION.UPSTREAM : _consts.DIRECTION.CURRENT | ||
}; | ||
@@ -978,5 +978,10 @@ }) | ||
var visitedNodesMap = {}; | ||
var parent = flow.parent(); | ||
var dir = function dir(f) { | ||
if (f === flow) return _consts.DIRECTION.CURRENT; | ||
if (f === parent) return _consts.DIRECTION.UPSTREAM; | ||
return _consts.DIRECTION.DOWNSTREAM; | ||
}; | ||
var route = getChildren(flow, []).concat(getChildren(flow.parent(), [{ flow: flow, direction: dir(flow) }])); | ||
var route = getChildren(flow, []).concat(getChildren(flow.parent(), [{ flow: flow, direction: _consts.DIRECTION.DOWNSTREAM }])); | ||
return route; | ||
@@ -986,3 +991,3 @@ function getChildren(flow, route) { | ||
visitedNodesMap[flow.guid()] = true; | ||
route = route.concat([{ flow: flow, direction: _consts.DIRECTION.DOWNSTREAM }]); | ||
route = route.concat([{ flow: flow, direction: dir(flow) }]); | ||
var nodes = [{ flow: flow, route: route }]; | ||
@@ -1374,3 +1379,3 @@ flow.children().forEach(function (f) { | ||
flow.version = ("0.2.3"); | ||
flow.version = ("0.2.4"); | ||
}; | ||
@@ -1377,0 +1382,0 @@ |
{ | ||
"name": "nflow", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "event/data/control flow", | ||
@@ -5,0 +5,0 @@ "main": "dist/nflow.js", |
@@ -15,3 +15,3 @@ import {isInternal, serialise} from './utils' | ||
f.isRemote | ||
? f.logger(remoteLog(flow, name, newData, oldData)) | ||
? f.logger(remoteLog(flow, name, newData, oldData), flow) | ||
: f.logger(flow, name, newData, oldData) | ||
@@ -26,3 +26,3 @@ }) | ||
global.__nflow_devtools_hook__( | ||
remoteLog(flow, name, newData, oldData)) | ||
remoteLog(flow, name, newData, oldData), flow) | ||
} | ||
@@ -29,0 +29,0 @@ |
@@ -5,4 +5,4 @@ import factory from './factory' | ||
var root = factory(DEFAULTS, "flow") | ||
var root = factory(DEFAULTS, "flow", []) | ||
logger.init(root) | ||
export default root |
@@ -12,7 +12,7 @@ import {DIRECTION} from '../consts' | ||
.slice(0,i+1) | ||
.map(f=>({ | ||
.map((f,i)=>({ | ||
flow:f, | ||
direction: DIRECTION.CURRENT | ||
direction: i?DIRECTION.UPSTREAM:DIRECTION.CURRENT | ||
})) | ||
})) | ||
) |
import {DIRECTION} from '../consts' | ||
export default (flow)=>{ | ||
var visitedNodesMap = {} | ||
var route = getChildren(flow, []) | ||
let visitedNodesMap = {} | ||
let parent = flow.parent() | ||
let dir = f=>{ | ||
if (f===flow) return DIRECTION.CURRENT | ||
if (f===parent) return DIRECTION.UPSTREAM | ||
return DIRECTION.DOWNSTREAM | ||
} | ||
let route = getChildren(flow, []) | ||
.concat(getChildren(flow.parent() | ||
,[{flow:flow, direction: DIRECTION.DOWNSTREAM}])) | ||
,[{flow:flow, direction: dir(flow)}])) | ||
@@ -14,3 +19,3 @@ return route; | ||
visitedNodesMap[flow.guid()] = true | ||
route = route.concat([{flow:flow, direction: DIRECTION.DOWNSTREAM}]) | ||
route = route.concat([{flow:flow, direction: dir(flow)}]) | ||
var nodes = [{ flow, route }] | ||
@@ -21,4 +26,5 @@ flow.children() | ||
} | ||
} | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
2581049
25763