UNPKG

655 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
15var prototype = inherits(Proxy, Transform);
16
17prototype.transform = function(_, pulse) {
18 this.value = _.value;
19 return _.modified('value')
20 ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS)
21 : pulse.StopPropagation;
22};