@connectv/core
Version:
agent-based reactive programming library for typescript/javascript
80 lines (79 loc) • 3.48 kB
TypeScript
import { Observable, PartialObserver, Subscription } from 'rxjs';
import { Emission } from '../shared/emission';
import { Tracker } from '../shared/tracker';
import { PinLike } from './pin-like';
/**
*
* The base class for [pins](https://connective.dev/docs/pin).
*
*/
export declare abstract class BasePin extends Tracker implements PinLike {
/**
*
* Connects given [pin](https://connective.dev/docs/pin) to this pin.
* Note that the operation might not be possible and result in an error.
*
* @param _ the pin that gets connected to this pin.
*
*/
abstract connect(_: PinLike): this;
/**
*
* The underlying observable of the pin. You can use this property
* to access the [emissions](https://connective.dev/docs/emission) instead of
* values, or to connect your CONNECTIVE flow into another observable sequence.
*
*/
abstract observable: Observable<Emission>;
/**
*
* Connects this pin to given pins. Will invoke `.from()` on the receiving pins.
* If any `PartialFlow` is among the given pins, the connection will be made 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 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 all given pins to this pin, by calling `.connect()` on each of them.
* If any `PartialFlow` is among given pins, the exit pins of the partial flow will be
* connected to this pin
* (read more about partial flows [here](https://connective.dev/docs/agent#implicit-connection)).
*
* @param pins the pins to be connected to this pin
* @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;
/**
*
* Connectss to given pins. This is same as `.to()`, except that when a `PartialFlow`
* is among the given pins, this pin will be connected only to its first entry pin
* (read more about partial flows [here](https://connective.dev/docs/agent#implicit-connection)).
*
* @param pins pins to connect this pin 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.
*
*/
serialTo(...pins: PinLike[]): PinLike;
/**
*
* Connects given pins to this pin. This is same as `.from()`, except that when a `PartialFlow`
* is among given pins, only its first exit pin will be connected to this pin
* (read more about partial flows [here](https://connective.dev/docs/agent#implicit-connection)).
*
* @param pins pins to connect to this pin
* @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;
subscribe(observer?: PartialObserver<any>): Subscription;
subscribe(next?: (value: any) => void, error?: (error: any) => void, complete?: () => void): Subscription;
}