<commit_before>import Sound from '../Sound'
import Display from '../Display'

class Manager {
  constructor({sound=[], display=[]}){
    this.currentAct = null

    this.sound = new Sound(...sound)
    this.display = new Display(...display)
  }

  connect(act){
    if(this.currentAct) this.disconnect(this.currentAct)

    const outputs = {
      display: this.display,
      sound: this.sound
    }

    act.start(outputs, next => (next ? this.connect(next) : this.disconnect(act)))

    this.currentAct = act
  }

  disconnect(act){
    if(act === this.currentAct){
      this.currentAct.end(true)

      if(this.sound.running) this.sound.pause()
      this.display.reset()

      this.currentView = null
    }
  }
}

export default Manager<commit_msg>🐛 Remove All Sound Listeners on transition<commit_after>import Sound from '../Sound'
import Display from '../Display'

class Manager {
  constructor({sound=[], display=[]}){
    this.currentAct = null

    this.sound = new Sound(...sound)
    this.display = new Display(...display)
  }

  connect(act){
    if(this.currentAct) this.disconnect(this.currentAct)

    const outputs = {
      display: this.display,
      sound: this.sound
    }

    act.start(outputs, next => (next ? this.connect(next) : this.disconnect(act)))

    this.currentAct = act
  }

  disconnect(act){
    if(act === this.currentAct){
      this.currentAct.end(true)

      if(this.sound.running) this.sound.pause()
      this.sound.removeAllListeners()
      this.display.reset()

      this.currentView = null
    }
  }
}

export default Manager
{'fraction_non_alphanumeric': 0.1439441978440076, 'fraction_numerical': 0.0, 'mean_word_length': 2.848780487804878, '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': '6237486', 'n_tokens_mistral': 505, 'n_tokens_neox': 488, 'n_words': 102}