runtime

@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
TypeScript
new Flow(options?): Flow;

Defined in: packages/runtime/src/base/flow.ts:176

Parameters
ParameterType
options?FlowOptions
Returns

Flow

Accessors

disposed
Get Signature
TypeScript
get disposed(): boolean;

Defined in: packages/runtime/src/base/flow.ts:184

Whether dispose has been called.

Returns

boolean

done
Get Signature
TypeScript
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()
TypeScript
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()
TypeScript
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
ParameterType
rootAnyNode
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
TypeScript
new FlowDisposedError(): FlowDisposedError;

Defined in: packages/runtime/src/core/backpressure.ts:14

Returns

FlowDisposedError

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 ParameterDefault type
TOptions extends objectNodeOptions

Constructors

Constructor
TypeScript
new Node<TOptions>(opts): Node<TOptions>;

Defined in: packages/runtime/src/node/node.ts:86

Parameters
ParameterType
optsTOptions
Returns

Node<TOptions>

Properties

PropertyModifierTypeDefault valueDescriptionDefined in
IreadonlyPortAccessor...Resolves an input port. Bound to the node, so it can be passed around as $i.packages/runtime/src/node/node.ts:81