<commit_before>import Plugin from './Plugin'

/**
 * Spinner
 *
 */
export default class Spinner extends Plugin {
  constructor (core, opts) {
    super(core, opts)
    this.type = 'progress'

    // set default options
    const defaultOptions = {}

    // merge default options with the ones set by user
    this.opts = Object.assign({}, defaultOptions, opts)
  }

  setProgress (percentage) {
    if (percentage !== 100) {
      this.spinnerEl.classList.add('is-spinning')
    } else {
      this.spinnerEl.classList.remove('is-spinning')
    }
  }

  initSpinner () {
    const spinnerContainer = document.querySelector(this.target)
    spinnerContainer.innerHTML = `<div class="UppySpinner"></div>`
    this.spinnerEl = document.querySelector(`${this.target} .UppySpinner`)
  }

  initEvents () {
    this.core.emitter.on('progress', data => {
      const percentage = data.percentage
      const plugin = data.plugin
      this.core.log(
        `progress is: ${percentage}, set by ${plugin.constructor.name}`
      )
      this.setProgress(percentage)
    })
  }

  install () {
    // this.core.log('the spinner target is... ' +
    //   this.getTarget(this.opts.target).spinner
    // )
    const caller = this
    this.target = this.getTarget(this.opts.target, caller)

    this.initSpinner()
    this.initEvents()
    return
  }
}<commit_msg>remove comment<commit_after>import Plugin from './Plugin'

/**
 * Spinner
 *
 */
export default class Spinner extends Plugin {
  constructor (core, opts) {
    super(core, opts)
    this.type = 'progress'

    // set default options
    const defaultOptions = {}

    // merge default options with the ones set by user
    this.opts = Object.assign({}, defaultOptions, opts)
  }

  setProgress (percentage) {
    if (percentage !== 100) {
      this.spinnerEl.classList.add('is-spinning')
    } else {
      this.spinnerEl.classList.remove('is-spinning')
    }
  }

  initSpinner () {
    const spinnerContainer = document.querySelector(this.target)
    spinnerContainer.innerHTML = `<div class="UppySpinner"></div>`
    this.spinnerEl = document.querySelector(`${this.target} .UppySpinner`)
  }

  initEvents () {
    this.core.emitter.on('progress', data => {
      const percentage = data.percentage
      const plugin = data.plugin
      this.core.log(
        `progress is: ${percentage}, set by ${plugin.constructor.name}`
      )
      this.setProgress(percentage)
    })
  }

  install () {
    const caller = this
    this.target = this.getTarget(this.opts.target, caller)

    this.initSpinner()
    this.initEvents()
    return
  }
}
{'fraction_non_alphanumeric': 0.1347708894878706, 'fraction_numerical': 0.0023103581055063534, 'mean_word_length': 2.7982456140350878, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6502616', 'n_tokens_mistral': 818, 'n_tokens_neox': 794, 'n_words': 168}