<commit_before>import Component from 'brindille-component';
import componentManager from 'lib/core/ComponentManager';
import Mediator from 'lib/Mediator';
import bindAll from 'lodash.bindall';

export default class View extends Component {
  constructor($el) {
    super($el);

    bindAll(this, 'onRoute', 'showFirstPage');

    Mediator.on('route:change:ready', this.onRoute);
    Mediator.once('route:change:first', this.showFirstPage);

    this.isSafariMobile = navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/);
  }

  dispose() {
    Mediator.off('route:change:ready', this.onRoute);
    Mediator.off('route:change:first', this.showFirstPage);
    super.dispose();
  }

  showFirstPage() {
    this.currentPage = this._componentInstances[0];
    this.currentPage.transitionIn(this.firstPageShown);
  }

  transitionInAndAfterOut() {
    this.addNewPage();

    this.currentPage.transitionIn(() => {
      this.removeAllChilds(this.currentPage);
      this.firstPageShown();
    });
  }

  transitionOutAndAfterIn() {
    this._componentInstances[this._componentInstances.length - 1].transitionOut(() => {
      this.removeAllChilds();
      this.addNewPage();
      this.currentPage.transitionIn(this.firstPageShown);
    });
  }

  removeAllChilds(except) {
    this._componentInstances.forEach((value) => {
      if (value !== except) value.dispose();
    });

    if (!except) this._componentInstances = [];
  }

  addNewPage() {
    this._componentInstances.push(this.currentPage);
    this.$el.appendChild(this.currentPage.$el);<commit_msg>fix null el after inAndAfterOut transition<commit_after>import Component from 'brindille-component';
import componentManager from 'lib/core/ComponentManager';
import Mediator from 'lib/Mediator';
import bindAll from 'lodash.bindall';

export default class View extends Component {
  constructor($el) {
    super($el);

    bindAll(this, 'onRoute', 'showFirstPage');

    Mediator.on('route:change:ready', this.onRoute);
    Mediator.once('route:change:first', this.showFirstPage);

    this.isSafariMobile = navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/);
  }

  dispose() {
    Mediator.off('route:change:ready', this.onRoute);
    Mediator.off('route:change:first', this.showFirstPage);
    super.dispose();
  }

  showFirstPage() {
    this.currentPage = this._componentInstances[0];
    this.currentPage.transitionIn(this.firstPageShown);
  }

  transitionInAndAfterOut() {
    this.addNewPage();

    this.currentPage.transitionIn(() => {
      this.removeAllChilds(this.currentPage);
      this.firstPageShown();
    });
  }

  transitionOutAndAfterIn() {
    this._componentInstances[this._componentInstances.length - 1].transitionOut(() => {
      this.removeAllChilds();
      this.addNewPage();
      this.currentPage.transitionIn(this.firstPageShown);
    });
  }

  removeAllChilds(except) {
    this._componentInstances.forEach((value, i) => {
      if (value !== except) {
        value.dispose();
        this._componentInstances.splice(i, 1);
      }
    });

    if (!except) this._componentInstances = [];
  }

  addNewPage() {
    this._componentInstances.push(this.currentPage);
    this.$el.appendChild(this.currentPage.$el);
{'fraction_non_alphanumeric': 0.14642313546423136, 'fraction_numerical': 0.0015220700152207, 'mean_word_length': 4.094573643410853, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4914548', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1015, 'n_words': 141}