@connectv/core
Version:
agent-based reactive programming library for typescript/javascript
134 lines (133 loc) • 5.23 kB
TypeScript
import { Observable, PartialObserver, Subscription } from 'rxjs';
import { Bindable } from '../shared/bindable';
import { Emission } from '../shared/emission';
import { PinLike } from './pin-like';
/**
*
* Represents [groups of pins](https://connective.dev/docs/group).
*
*/
export declare class Group implements PinLike, Bindable {
/**
*
* The array of all pins within the group.
*
*/
readonly pins: PinLike[];
constructor(pins: PinLike[]);
/**
*
* @warning accessing this will result in an error since groups do not have
* underlying observables of their own.
*
*/
get observable(): Observable<Emission>;
/**
*
* Connects all given pins to all pins in this group, so
* `group(c, d).from(a, b)` means both `a` and `b` will be connected
* to both `c` and `d`.
*
* If any `PartialFlow` is among given pins, all of the exit pins of the partial flow will be
* connected to all of the pins of this group
* (read more about partial flows [here](https://connective.dev/docs/agent#implicit-connection)).
*
* @param pins pins to be connected to pins of this group
* @returns a [group](https://connective.dev/docs/group) of the given pins. If any `PartialFlow`
* was among the given pins, its entry pins will be added to the group.
*
*/
from(...pins: PinLike[]): PinLike;
/**
*
* Connects all pins of this group to all of the given pins, so
* `group(a, b).to(c, d)` means both `a` and `b` will be connected to
* both `c` and `d`.
*
* If any `PartialFlow` is among the given pins, all pins of the group will be connected to all of
* its entry pins (read more about partial flows [here](https://connective.dev/docs/agent#implicit-connection)).
*
* @param pins the pins to connect pins of this group to
* @returns a [group](https://connective.dev/docs/group) of the given pins. If any `PartialFlow`
* was among the given pins, its exit pins added to the group.
*
*/
to(...pins: PinLike[]): PinLike;
/**
*
* Connects given pins serially to pins of this group, i.e. the first to the first,
* second to the second, etc. If any `PartialFlow` is among the given pins, then
* its exit pins will be connected serially to pins of this group
* (read more about partial flows [here](https://connective.dev/docs/agent#implicit-connection)).
* If a mixture of `PartialFlow`s and normal pins are given, the normal pins will
* be connected to pins of this group serially without counting the partial flows, and the
* partial flows will each be connected to pins of this group as described.
*
* @param pins pins to be connected to pins of this group serially.
* @returns a [group](https://connective.dev/docs/group) of the given pins. If any `PartialFlow`
* was among the given pins, its entry pins will be added to the group.
*
*/
serialFrom(...pins: PinLike[]): PinLike;
/**
*
* Connects pins of this group serially to given pins, i.e. first to the first,
* second to the second, etc. If any `PartialFlow` is among the given pins, pins of
* this group will be connected serially to its entries
* (read more about partial flows [here](https://connective.dev/docs/agent#implicit-connection)).
* If a mixture of `PartialFlow`s and normal pins are given, pins of this group will
* be connected to the normal pins serially without counting the partial flows, and they
* will be connected to the partial flows as described.
*
* @param pins pins that pins of this group should connect to serially.
* @returns a [group](https://connective.dev/docs/group) of the given pins. If any `PartialFlow`
* was among the given pins, its exit pins added to the group.
*
*/
serialTo(...pins: PinLike[]): PinLike;
/**
*
* Calls `.clear()` on all pins of the group
*
*/
clear(): this;
/**
*
* Calls `.bind()` on all pins of the group
*
*/
bind(): this;
subscribe(observer?: PartialObserver<any>): Subscription;
subscribe(next?: (value: any) => void, error?: (error: any) => void, complete?: () => void): Subscription;
}
/**
*
* Creates a [group of pins](https://connective.dev/docs/group) based on given pins.
*
* @param pins
*
*/
export declare function group(...pins: PinLike[]): Group;
/**
*
* Determines which pins should be considered if in a connection chain
* we are connecting to the given pins. This is typically a `Group` consisting
* of given pins, but if any `PartialFlow`s are among them, their exit pins are
* added to the group instead.
*
* @param pins
*
*/
export declare function traverseTo(...pins: PinLike[]): PinLike;
/**
*
* Determines which pins should be considered if in a connection chain
* we are connecting from the given pins. This is typically a `Group` consisting
* of given pins, but if any `PartialFlow`s are among them, their entry pins are
* added to the group instead.
*
* @param pins
*
*/
export declare function traverseFrom(...pins: PinLike[]): PinLike;
export default group;