@connectv/core
Version:
agent-based reactive programming library for typescript/javascript
42 lines (41 loc) • 1.28 kB
TypeScript
import { PinLike } from '../pin/pin-like';
import { Control } from '../pin/control';
import { Agent } from './agent';
import { AgentLike } from './agent-like';
import { NodeLike } from './node-like';
/**
*
* A class to wrap an agent so that it behaves like a [node](https://connective.dev/docs/node).
*
*/
export declare class NodeWrap extends Agent implements NodeLike {
readonly core: AgentLike;
private _control;
private _pack;
private _control_required;
/**
*
* @param core the original agent to be wrapped.
*
*/
constructor(core: AgentLike);
get control(): Control;
protected createInput(label: string): PinLike;
protected createOutput(label: string): PinLike;
clear(): this;
}
/**
*
* Wraps given agent in a `NodeWrap`, making it behave like a
* [node](https://connective.dev/docs/node):
*
* - It will wait for all of its inputs to emit at least once before first execution
* - Re-executes any time a new value is emitted from any of the inputs
* - Waits for its `.control` if its connected before each execution
* - Responds with the first output of the wrapped agent for each execution
*
* @param agent
*
*/
export declare function nodeWrap(agent: AgentLike): NodeLike;
export default nodeWrap;