UNPKG

@connectv/core

Version:

agent-based reactive programming library for typescript/javascript

53 lines (52 loc) 2 kB
import { PinLike } from '../pin/pin-like'; import { Control } from '../pin/control'; import { Signature } from './signature'; import { Agent } from './agent'; import { NodeLike } from './node-like'; import { AgentFactory } from './call'; /** * * Represents [invoke](https://connective.dev/docs/invoke) agents. * */ export declare class Invoke extends Agent implements NodeLike { readonly ref: AgentFactory; private _relay; private _control; private _all_subs; private _control_required; /** * * @param ref the agent factory to be used in response to each set of incoming data * @param signature an optional signature denoting the signature of the agents that * are to be created. If not provided and not directly deducable from the factory function itself, * the factory function will be invoked once to deduce the signature. * */ constructor(ref: AgentFactory, signature?: Signature); protected createOutput(label: string): PinLike; protected createEntries(): PinLike[]; protected createExits(): PinLike[]; /** * * You can control when the agent creates the inner-agent and runs it on latest set of * incoming values by emitting to `.control`. * */ get control(): Control; clear(): this; } /** * * Creates an [invoke](https://connective.dev/docs/invoke) agent. Invoke * agents create an inner-agent using the given factory in response to each set of incoming inputs * and emit the first output of the inner-agent in response. * [Checkout the docs](https://connective.dev/docs/invoke) for examples and further information. * * @param ref the agent factory to be used to create inner-agents * @param signature the signature of the inner-agents. If not provided and not deducable from * the factory function, the factory function will be invoked once to deduce this. * */ export declare function invoke(ref: AgentFactory, signature?: Signature): Invoke; export default invoke;