node-red-contrib-actionflows
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -313,4 +313,3 @@ module.exports = function(RED) { | ||
if (ains.length > 0) { | ||
msg._af["stack"].push(event); | ||
RED.events.emit("af:" + ains.shift().id, msg); | ||
callActionIn(); | ||
}else{ | ||
@@ -329,5 +328,11 @@ RED.events.removeListener(event, handler); | ||
if (ains.length > 0) { | ||
var id = ains.shift().id; | ||
callActionIn(); | ||
} | ||
function callActionIn() { | ||
msg._af["stack"].push(event); | ||
RED.events.emit("af:" + id, msg); | ||
var ain_node = ains.shift(); | ||
if (sName == "#deployed") { | ||
msg.payload = Object.assign({}, getParent(ain_node)); | ||
} | ||
RED.events.emit("af:" + ain_node.id, msg); | ||
} | ||
@@ -334,0 +339,0 @@ return p; |
{ | ||
"name": "node-red-contrib-actionflows", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Create extendable, loopable, and reusable design patterns for flows.", | ||
@@ -5,0 +5,0 @@ "author": "Stephen J. Carnam <steveorevo@gmail.com>", |
@@ -258,3 +258,3 @@ # node-red-contrib-actionflows | ||
(object oriented programming) environments. Using scopes with ActionFlows allows | ||
you to build reusable flow libraries that may act as base for other flows. | ||
you to build reusable flow libraries that may act as a base for other flows. | ||
Regardless of the scope setting, `action` nodes will invoke all matching | ||
@@ -312,3 +312,3 @@ `action in` flows that are on the same "z plane" (same tab or within the same | ||
inside the subflow named "acme". | ||
2b) Within the "acme" subflow is the `action in` node named "sample". | ||
2b) Within the "acme" subflow is the `action in` node named "sample in". | ||
@@ -380,2 +380,3 @@ The flow segment has a change node that changes the injector's "Hello" | ||
[Download the JavaScript Invoke example flow here.](/actionflows/demo/invoke.json) | ||
*Note: the JavaScript Invoke example requires the [string](https://flows.nodered.org/node/node-red-contrib-string) node.* | ||
@@ -428,7 +429,16 @@ The `actionflows` global object contains the following methods and properties of | ||
``` | ||
Any `action in` nodes that start with `#deployed` in their name will be invoked | ||
at deployment. This would be the equivalent of paring an inject node with the | ||
Any `action in` nodes that start with "#deployed" in their name will be invoked | ||
at deployment. This would be the equivalent of pairing an inject node with the | ||
option for "Inject once at start" set to invoke a flow segment defined by | ||
ActionFlows. | ||
ActionFlows. The `action in` node named "#deployed" will also contain a | ||
msg.payload object property that references the *parent container* the | ||
`action in` node lives in (i.e. a tab or subflow). | ||
![#deployed Event](/actionflows/demo/deployed.jpg?raw=true "#deployed Event") | ||
This feature can be used to obtain the subflow instance name should you require | ||
a reference to it within your subflow object instance. | ||
[Download the #deployed event example flow here.](/actionflows/demo/deployed.json) | ||
## Installation | ||
@@ -435,0 +445,0 @@ Run the following command in your Node-RED user directory (typically ~/.node-red): |
1428148
29
1529
447