How to use the vega-dataflow.EventStream function in vega-dataflow

To help you get started, we’ve selected a few vega-dataflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vega / vega / packages / vega-view / src / events.js View on Github external
export function events(source, type, filter) {
  var view = this,
      s = new EventStream(filter),
      send = function(e, item) {
        view.runAsync(null, () => {
          if (source === VIEW && prevent(view, type)) {
            e.preventDefault();
          }
          s.receive(eventExtend(view, e, item));
        });
      },
      sources;

  if (source === TIMER) {
    if (permit(view, 'timer', type)) {
      view.timer(send, type);
    }
  }
github vega / vega / src / view / events.js View on Github external
export default function(source, type, filter) {
  var view = this,
      s = new EventStream(filter),
      send = function(e, item) {
        s.receive(eventExtend(view, e, item));
        view.run();
      },
      sources;

  if (source === 'view') {
    view._handler.on(type, send);
    return s;
  }

  if (source === 'window') {
    if (typeof window !== 'undefined') sources = [window];
  } else if (typeof document !== 'undefined') {
    sources = document.querySelectorAll(source);
  }
github vega / vega / src / View.js View on Github external
prototype.events = function(source, type, filter) {
  var view = this,
      s = new EventStream(filter),
      send = function(e, item) {
        s.receive(view.extendEvent(e, item));
        view.run();
      },
      sources;

  if (source === 'view') {
    this._handler.on(type, send);
    return s;
  }

  if (source === 'window') {
    sources = [window];
  } else if (typeof document !== 'undefined') {
    sources = document.querySelectorAll(source);
  }