UNPKG

625 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
15inherits(Sieve, Transform, {
16 transform(_, pulse) {
17 this.value = pulse.source;
18 return pulse.changed()
19 ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS)
20 : pulse.StopPropagation;
21 }
22});
23