UNPKG

633 BJavaScriptView Raw
1import {Transform} from 'vega-dataflow';
2import {inherits} from 'vega-util';
3
4/**
5 * Proxy the value of another operator as a pure signal value.
6 * Ensures no tuples are propagated.
7 * @constructor
8 * @param {object} params - The parameters for this operator.
9 * @param {*} params.value - The value to proxy, becomes the value of this operator.
10 */
11export default function Proxy(params) {
12 Transform.call(this, null, params);
13}
14
15inherits(Proxy, Transform, {
16 transform(_, pulse) {
17 this.value = _.value;
18 return _.modified('value')
19 ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS)
20 : pulse.StopPropagation;
21 }
22});