<commit_before>import debounce from 'lodash.debounce'

class ResizeHandler {
  constructor() {
    this._queue = []
    this.update = debounce(this.update.bind(this), 150)
    window.addEventListener('resize', this.update)
  }

  destroy() {
    window.removeEventListener('resize', this.update)
  }

  add(component) {
    this._queue.push(component)
  }

  remove(component) {
    const pos = this._queue.indexOf(component)
    if (pos > -1) {
      this._queue.splice(pos, 1)
    }    
  }

  update() {
    for (let i = this._queue.length; i--;) {
      this._queue[i].getDimensions()
    }
  }
}

export default ResizeHandler<commit_msg>fixed measuring on resize<commit_after>import debounce from 'lodash.debounce'

class ResizeHandler {
  constructor() {
    this._queue = []
    this.update = debounce(this.update.bind(this), 150)
    window.addEventListener('resize', this.update)
  }

  destroy() {
    window.removeEventListener('resize', this.update)
  }

  add(component) {
    this._queue.push(component)
  }

  remove(component) {
    const pos = this._queue.indexOf(component)
    if (pos > -1) {
      this._queue.splice(pos, 1)
    }    
  }

  update() {
    for (let i = this._queue.length; i--;) {
      this._queue[i]._measure()
    }
  }
}

export default ResizeHandler
{'fraction_non_alphanumeric': 0.14252517428350117, 'fraction_numerical': 0.0077459333849728895, 'mean_word_length': 2.9390243902439024, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1033187', 'n_tokens_mistral': 448, 'n_tokens_neox': 426, 'n_words': 76}