Helper function to verify given object of inputs has required input IDs. Throws error if validation fails.
-
-
-
Dataflow graph initialization function. Takes a state Atom (or null
if not needed) and an object of NodeSpec values or functions returning Node objects. Calls nodeFromSpec()
for each spec and then recursively resolves references via {@link @thi.ng/resolve-map#resolve}. Returns new initialized graph object of Node objects and {@link @thi.ng/rstream# | @thi.ng/rstream} stream constructs. Does NOT mutate original GraphSpec object.
-
-
Higher order node / stream creator. Takes a transducer and (optional) required input stream IDs. The returned function takes an object of input streams and returns a new {@link @thi.ng/rstream#StreamSync} instance. The returned function will throw an error if inputIDs
is given and the object of inputs does not contain all of them.
If reset
is true (default: false), the xform
will only re-run when all inputs have produced new values. See {@link @thi.ng/rstream#StreamSync} for further reference.
// TODO add close behavior opts
-
-
-
Similar to node, but optimized for nodes using only a single input. Uses "src" as default input ID.
// TODO add close behavior opts
-
-
Syntax sugar for node()
, intended for nodes w/ 2 inputs, by default named a
& b
(but can be overridden).
-
-
-
Transforms a single NodeSpec into a lookup function for {@link resolve} (which is called from initGraph). When that function is called, recursively resolves all specified input streams and calls this spec's fn
to produce a new stream from these inputs.
If the spec includes the optional outs
keys, it also creates the subscriptions for each of the given output keys, which then can be used as inputs by other nodes. Each value in the outs
subspec can be a function or state path (string/number/array, see {@link @thi.ng/paths# | @thi.ng/paths}). Functions are called with this node's constructed stream/subscribable and the output id and must return a new {@link @thi.ng/rstream#ISubscribable}. For path values a subscription is added to this node's result stream which then updates the provided state atom at the path given.
Non-function output specs subs assume the raw node output value is an object from which the different output keys are being extracted. The special *
output key can be used to handle the entire node output value. This is useful/required for non-object node result values.
-
-
-
Calls .unsubscribe()
on given node and all of its outputs, then removes it from graph. Returns false
if no node exists for given id
.
-
-
Calls .unsubscribe()
on all nodes in the graph, causing all related streams & subscriptions to terminate.
-
Generated using TypeDoc
Compiles given NodeSpec and adds it to graph. Returns compiled Node object for the given spec. Throws error if the graph already contains a node with given
id
.