@connectv/core
Version:
agent-based reactive programming library for typescript/javascript
31 lines • 946 B
JavaScript
import { map } from 'rxjs/operators';
import emission from '../shared/emission';
import { PinLockedError } from './errors/locked.error';
import { BasePin } from './base';
/**
*
* Represents [wrap](https://connective.dev/docs/wrap) pins.
*
*/
class Wrapper extends BasePin {
constructor(observable) {
super();
this.observable = observable.pipe(map(v => emission(v)));
}
connect(_) {
throw new PinLockedError();
}
}
/**
*
* Creates a [wrap](https://connective.dev/docs/wrap) pin. A wrap pin
* wraps a given observable so that it can be connected to other pins. Because
* its observable is already realized, you cannot connect other pins to a wrap pin.
* [Checkout the docs](https://connective.dev/docs/wrap) for examples and further information.
*
* @param observable
*
*/
export function wrap(observable) { return new Wrapper(observable); }
export default wrap;
//# sourceMappingURL=wrap.js.map