@hlang-org/runtime
A FBP-Inspired language for universal applications. Version 2.1.0, 27 exports.
Classes
Flow
Defined in: packages/runtime/src/base/flow.ts:149
Runs a graph of nodes from a Readable root. A flow belongs to its host: no node can reach it, and its record of wired connections is private.
A flow owns the nodes it starts. dispose ends them: it cuts the flow's
connections, runs their teardowns and completes their ports.
Constructors
Constructor
new Flow(options?): Flow;Defined in: packages/runtime/src/base/flow.ts:176
Parameters
| Parameter | Type |
|---|---|
options? | FlowOptions |
Returns
Accessors
disposed
Get Signature
get disposed(): boolean;Defined in: packages/runtime/src/base/flow.ts:184
Whether dispose has been called.
Returns
boolean
done
Get Signature
get done(): Promise<void>;Defined in: packages/runtime/src/base/flow.ts:194
Resolves once every node this flow runs has finished (RFC 0001): its
inputs have ended and its outputs are closed. A source that never closes
keeps it pending, as does a feedback loop no node of which closes.
Rejects with FlowDisposedError if the flow is disposed first.
Returns
Promise<void>
Methods
dispose()
dispose(): void;Defined in: packages/runtime/src/base/flow.ts:272
Ends every node this flow started. In order: the flow's connections are cut, so nothing more is delivered (messages already queued are dropped, and a scheduled slice does nothing); each node's teardown runs, the last started first, with a failing one reported like any other failure while the rest still run; then the nodes' ports complete, which ends every subscription made on them, and later sends are dropped. Nodes another flow started are left running.
Safe to call more than once, and from inside a delivery. A disposed flow cannot run again.
Returns
void
run()
run(root): void;Defined in: packages/runtime/src/base/flow.ts:211
Builds the graph downstream of root, wires every connection through the
delivery queue, and starts each node once: Writables first, then
Transforms, then the root, so every receiver exists before a source sends.
Parameters
| Parameter | Type |
|---|---|
root | AnyNode |
Returns
void
FlowDisposedError
Defined in: packages/runtime/src/core/backpressure.ts:13
Thrown into whatever waits on a flow that has been disposed: ready(), write().
Extends
Error
Constructors
Constructor
new FlowDisposedError(): FlowDisposedError;Defined in: packages/runtime/src/core/backpressure.ts:14
Returns
Overrides
Error.constructor
abstract Node
Defined in: packages/runtime/src/node/node.ts:51
The base of the three node kinds. Subclass ReadableNode, TransformNode
or WriteableNode; TOptions is the shape of the options the node is
constructed with.
A node holds its own options and ports and nothing else: it cannot reach the flow that runs it or any other node, so the only thing nodes share is the messages on their connections.
Extended by
Type Parameters
| Type Parameter | Default type |
|---|---|
TOptions extends object | NodeOptions |
Constructors
Constructor
new Node<TOptions>(opts): Node<TOptions>;Defined in: packages/runtime/src/node/node.ts:86
Parameters
| Parameter | Type |
|---|---|
opts | TOptions |
Returns
Node<TOptions>
Properties
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
I | readonly | PortAccessor | ... | Resolves an input port. Bound to the node, so it can be passed around as $i. | packages/runtime/src/node/node.ts:81 |