UNPKG

646 BJavaScriptView Raw
1import {Transform} from 'vega-dataflow';
2import {inherits} from 'vega-util';
3
4/**
5 * Propagates a new pulse without any tuples so long as the input
6 * pulse contains some added, removed or modified tuples.
7 * @param {object} params - The parameters for this operator.
8 * @constructor
9 */
10export default function Sieve(params) {
11 Transform.call(this, null, params);
12 this.modified(true); // always treat as modified
13}
14
15var prototype = inherits(Sieve, Transform);
16
17prototype.transform = function(_, pulse) {
18 this.value = pulse.source;
19 return pulse.changed()
20 ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS)
21 : pulse.StopPropagation;
22};