UNPKG

@connectv/core

Version:

agent-based reactive programming library for typescript/javascript

46 lines (45 loc) 1.56 kB
import { Observable } from 'rxjs'; import { Emission } from '../shared/emission'; import { Pin } from './pin'; import { PinLike } from './pin-like'; /** * * Represents [control](https://connective.dev/docs/control) pins. * */ export declare class Control extends Pin { readonly val: any; constructor(val?: any); /** * * Resolves underlying observable, by * [zipping](https://rxjs-dev.firebaseapp.com/api/index/function/zip) * corresponding observables of inbound pins. * * If a `PinMap` is passed to the constructor, it will instead * resolve to zip of all of the instantiated pins of that `PinMap`. * * If a value is passed to the constructor, and there are no inbound * pins, it will resolve to `of(<passed value>)`. * * @param inbound * */ protected resolve(inbound: PinLike[]): Observable<Emission>; } /** * * Creates a [control](https://connective.dev/docs/control) pin. * * @param val if provided, the control pin will emit the given value when * all pins connected to it emit, otherwise it will emit the array concatenation * of received values. If no pins are connected to it, then it will emit the value * to any subscriber (or to any pin that this pin is connected to, when a subscription * is called somwhere down the chain). * * If a `PinMap` is given as the value, then after resolution, the control will be * connected to all "realised" pins of the given pinmap. * */ export declare function control(val?: any): Control; export default control;