@connectv/core
Version:
agent-based reactive programming library for typescript/javascript
41 lines (40 loc) • 1.13 kB
TypeScript
import { Bindable } from '../shared/bindable';
import { ContextType } from '../shared/types';
import { Pipe } from './pipe';
export declare type SinkFunc = (value: any, context: ContextType) => void;
/**
*
* Represents [sink](https://connective.dev/docs/sink) pins.
*
*/
export declare class Sink extends Pipe implements Bindable {
readonly func: SinkFunc;
private _bound;
constructor(func?: SinkFunc);
/**
*
* @returns `true` if this sink is already bound.
*
*/
get bound(): boolean;
/**
*
* Binds this sink if it is not already bound. Binding
* Basically ensures that the pin is subscribed to and that its side-effect
* will be enacted.
*
*/
bind(): this;
}
/**
*
* Creates a [sink](https://connective.dev/docs/sink) pin.
* Sink pins can be used to do something with the data of a flow, outside the scope of the flow
* (like logging them, etc).
* [Checkout the docs](https://connective.dev/docs/sink) for examples and further information.
*
* @param func
*
*/
export declare function sink(func?: SinkFunc): Sink;
export default sink;