How to use the min-dash.debounce function in min-dash

To help you get started, we’ve selected a few min-dash 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 zeebe-io / zeebe-modeler / client / src / util / debounce.js View on Github external
export default function debounce(fn) {

  // noop during testing
  if (process.env.NODE_ENV === 'test') {
    return fn;
  }

  return _debounce(fn, 300);
}
github zeebe-io / zeebe-modeler / client2 / lib / app / app.js View on Github external
];

  this.activeTab = null;

  this.fileHistory = [];


  this.events.on('deploy:endpoint:update', endpoints => {
    this.persistEndpoints(endpoints);
  });

  this.events.on('deploy', (payload, done) => {
    this.triggerAction('deploy', payload, done);
  });

  this.events.on('workspace:changed', debounce((done) => {
    this.persistWorkspace((err) => {
      debug('workspace persisted?', err);

      // this is to prevent a race condition when quitting the app
      if (done) {
        done(err);
      }
    });
  }, 100));


  this.events.on('tools:state-changed', (tab, newState) => {

    var button, selectedEditor;

    if (this.activeTab !== tab) {
github zeebe-io / zeebe-modeler / client / src / app / App.js View on Github external
];

    // remember the original App#checkFileChanged version
    // for testing purposes
    this.__checkFileChanged = this.checkFileChanged;

    // ensure we do not accidently execute the method recursively
    // cf. https://github.com/camunda/camunda-modeler/issues/1118
    this.checkFileChanged = executeOnce(
      (tab) => this.__checkFileChanged(tab),
      (tab) => tab.id
    );

    if (process.env.NODE_ENV !== 'test') {
      this.workspaceChanged = debounce(this.workspaceChanged, 1500);
      this.updateMenu = debounce(this.updateMenu, 50);
      this.resizeTab = debounce(this.resizeTab, 50);
    }

    this.currentNotificationId = 0;
  }
github zeebe-io / zeebe-modeler / client / src / app / App.js View on Github external
// remember the original App#checkFileChanged version
    // for testing purposes
    this.__checkFileChanged = this.checkFileChanged;

    // ensure we do not accidently execute the method recursively
    // cf. https://github.com/camunda/camunda-modeler/issues/1118
    this.checkFileChanged = executeOnce(
      (tab) => this.__checkFileChanged(tab),
      (tab) => tab.id
    );

    if (process.env.NODE_ENV !== 'test') {
      this.workspaceChanged = debounce(this.workspaceChanged, 1500);
      this.updateMenu = debounce(this.updateMenu, 50);
      this.resizeTab = debounce(this.resizeTab, 50);
    }

    this.currentNotificationId = 0;
  }
github bpmn-io / dmn-js / packages / dmn-js-shared / src / base / Manager.js View on Github external
constructor(options={}) {
    this._eventBus = new EventBus();

    this._viewsChanged = debounce(this._viewsChanged, 0);

    this._views = [];
    this._viewers = {};

    this._init(options);
  }
github zeebe-io / zeebe-modeler / client / src / plugins / deployment-tool / DeploymentDetailsModal.js View on Github external
}

    this.setState({
      checkingConnection: true,
      connectionHint: null,
      lastUsername: values.username,
      lastPassword: values.password,
      lastAuthType: values.authType
    });

    const connectionError = await this.props.checkConnection(values);

    this.mounted && this.setState({ connectionError, checkingConnection: false });
  }

  lazilyCheckConnection = debounce(this.checkConnection, 1000);

  moreLazilyCheckConnection = debounce(this.checkConnection, 2000);

  validate = values => {
    const errors = this.props.validate(values);

    this.checkConnectionIfNeeded(values, errors);

    return errors;
  }

  checkConnectionIfNeeded(values, errors, immediately = false) {

    const {
      authType,
      username,
github bpmn-io / bpmn-js-examples / properties-panel / app / index.js View on Github external
});

  function setEncoded(link, name, data) {
    var encodedData = encodeURIComponent(data);

    if (data) {
      link.addClass('active').attr({
        'href': 'data:application/bpmn20-xml;charset=UTF-8,' + encodedData,
        'download': name
      });
    } else {
      link.removeClass('active');
    }
  }

  var exportArtifacts = debounce(function() {

    saveSVG(function(err, svg) {
      setEncoded(downloadSvgLink, 'diagram.svg', err ? null : svg);
    });

    saveDiagram(function(err, xml) {
      setEncoded(downloadLink, 'diagram.bpmn', err ? null : xml);
    });
  }, 500);

  bpmnModeler.on('commandStack.changed', exportArtifacts);
});
github bpmn-io / dmn-js / packages / dmn-js-shared / lib / features / debounce-input / debounceInput.js View on Github external
return function _debounceInput(fn) {
    if (shouldDebounce !== false) {

      var debounceTime =
        isNumber(shouldDebounce) ?
          shouldDebounce :
          DEFAULT_DEBOUNCE_TIME;

      return debounce(fn, debounceTime);
    } else {
      return fn;
    }
  };
}
github bpmn-io / bpmn-js-examples / transaction-boundaries / app / index.js View on Github external
});

  function setEncoded(link, name, data) {
    var encodedData = encodeURIComponent(data);

    if (data) {
      link.addClass('active').attr({
        'href': 'data:application/bpmn20-xml;charset=UTF-8,' + encodedData,
        'download': name
      });
    } else {
      link.removeClass('active');
    }
  }

  var exportArtifacts = debounce(function() {

    saveSVG(function(err, svg) {
      setEncoded(downloadSvgLink, 'diagram.svg', err ? null : svg);
    });

    saveDiagram(function(err, xml) {
      setEncoded(downloadLink, 'diagram.bpmn', err ? null : xml);
    });
  }, 500);

  bpmnModeler.on('commandStack.changed', exportArtifacts);
});
github bpmn-io / bpmn-js-examples / properties-panel-extension / app / index.js View on Github external
});

  function setEncoded(link, name, data) {
    var encodedData = encodeURIComponent(data);

    if (data) {
      link.addClass('active').attr({
        'href': 'data:application/bpmn20-xml;charset=UTF-8,' + encodedData,
        'download': name
      });
    } else {
      link.removeClass('active');
    }
  }

  var exportArtifacts = debounce(function() {

    saveSVG(function(err, svg) {
      setEncoded(downloadSvgLink, 'diagram.svg', err ? null : svg);
    });

    saveDiagram(function(err, xml) {
      setEncoded(downloadLink, 'diagram.bpmn', err ? null : xml);
    });
  }, 500);

  bpmnModeler.on('commandStack.changed', exportArtifacts);
});