@connectv/core
Version:
agent-based reactive programming library for typescript/javascript
32 lines (31 loc) • 1.09 kB
TypeScript
import { ErrorCallback, ContextType } from '../shared/types';
import { Node, NodeInputs, NodeOutput } from './node';
export declare type ExprNoArgFunc = (error: ErrorCallback, context: ContextType) => any;
export declare type ExprWithArgFunc = (...args: any[]) => any;
export declare type ExprFunc = ExprNoArgFunc | ExprWithArgFunc;
/**
*
* Represents [expression](https://connective.dev/docs/expr) agents.
*
*/
export declare class Expr extends Node {
/**
*
* The expression function
*
*/
readonly func: any;
constructor(func: ExprNoArgFunc);
constructor(inputs: string[], func: ExprWithArgFunc);
protected run(inputs: NodeInputs, output: NodeOutput, error: ErrorCallback, context: ContextType): void;
/**
*
* Shortcut for `.out('result')`. The result of the evaluation of the
* expression will be emitted via this output.
*
*/
get result(): import("..").PinLike;
}
export declare function expr(func: ExprFunc): Expr;
export declare function expr(inputs: string[], func: ExprFunc): Expr;
export default expr;