<commit_before>cdb.windshaft.Dashboard = function(options) {
  BOUNDING_BOX_FILTER_WAIT = 500;

  this.layerGroup = options.layerGroup;
  this.layers = new Backbone.Collection(options.layers);
  this.widgets = new Backbone.Collection(options.widgets);
  this.filters = new cdb.windshaft.filters.Collection(options.filters);
  this.map = options.map;
  this.client = options.client;
  this.statTag = options.statTag;
  this.configGenerator = options.configGenerator;

  this.instance = new cdb.windshaft.DashboardInstance();

  this.boundingBoxFilter = new cdb.windshaft.filters.BoundingBoxFilter(this.map.getViewBounds());

  // Bindings
  this.layerGroup.bindDashboardInstance(this.instance);
  this.layers.bind('change', this.createInstance, this);
  this.filters.bind('change', this.createInstance, this);

  // When the instance has changed, we need to update some models (eg: widgets) in this class
  // with the information that the instance contains.
  var self = this;
  this.instance.bind('change:layergroupid', function(dashboardInstance) {

    // TODO: Set the URL of the attributes service once it's available
    this.layerGroup.set({
      urls: dashboardInstance.getTiles()
    });

    this._updateWidgetURLs();
  }.bind(this));

  this.map.bind('change:center', _.debounce(this._boundingBoxChanged, BOUNDING_BOX_FILTER_WAIT), this);
};

cdb.windshaft.Dashboard.prototype._boundingBoxChanged = function() {
  if (this.instance.isLoaded()) {
    this.boundingBoxFilter.setBounds(this.map.getViewBounds());

    this._updateWidgetURLs();<commit_msg>Refresh the widgets when the zoom changes<commit_after>cdb.windshaft.Dashboard = function(options) {
  BOUNDING_BOX_FILTER_WAIT = 500;

  this.layerGroup = options.layerGroup;
  this.layers = new Backbone.Collection(options.layers);
  this.widgets = new Backbone.Collection(options.widgets);
  this.filters = new cdb.windshaft.filters.Collection(options.filters);
  this.map = options.map;
  this.client = options.client;
  this.statTag = options.statTag;
  this.configGenerator = options.configGenerator;

  this.instance = new cdb.windshaft.DashboardInstance();

  this.boundingBoxFilter = new cdb.windshaft.filters.BoundingBoxFilter(this.map.getViewBounds());

  // Bindings
  this.layerGroup.bindDashboardInstance(this.instance);
  this.layers.bind('change', this.createInstance, this);
  this.filters.bind('change', this.createInstance, this);

  // When the instance has changed, we need to update some models (eg: widgets) in this class
  // with the information that the instance contains.
  var self = this;
  this.instance.bind('change:layergroupid', function(dashboardInstance) {

    // TODO: Set the URL of the attributes service once it's available
    this.layerGroup.set({
      urls: dashboardInstance.getTiles()
    });

    this._updateWidgetURLs();
  }.bind(this));

  this.map.bind('change:center change:zoom', _.debounce(this._boundingBoxChanged, BOUNDING_BOX_FILTER_WAIT), this);
};

cdb.windshaft.Dashboard.prototype._boundingBoxChanged = function() {
  if (this.instance.isLoaded()) {
    this.boundingBoxFilter.setBounds(this.map.getViewBounds());

    this._updateWidgetURLs();
{'fraction_non_alphanumeric': 0.12152777777777778, 'fraction_numerical': 0.001893939393939394, 'mean_word_length': 4.782846715328467, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4091410', 'n_tokens_mistral': 989, 'n_tokens_neox': 962, 'n_words': 188}