<commit_before>Wheel.Class('Wheel.App', {
  _preInit: function(opts) {
    this._super(opts);
    this.initApp();
    this._class.app = this;
    this._class.App = this._class;
  },

  initApp: function() {
    this.eventManager = Modernizr.touch ? Wheel.TouchManager.build() : Wheel.MouseManager.build();
    this.templates = Wheel.Templates.build();
    this.templates.gather(); // no harm, no foul
  },

  manageRequests: function() {
    this.connectionChecker = Wheel.Utils.ConnectionChecker.build();
    this.requestQueue = Wheel.Utils.RequestQueue.build({app: this});

    this.connectionChecker.on('offline', function() {
      this.connected(false);
    }.bind(this));

    this.connectionChecker.on('online', function() {
      this.connected(true);
    }.bind(this));
  },

  checkConnection: function() {
    if ( ('onLine' in navigator) && (navigator.onLine == false)) {
      this.connected(false);
    } else {
      this.connectionChecker.test();
    }
  },

  connected: function(value) {
    if (value != undefined && this._connected != value) {
      var event = value ? 'online' : 'offline';
      this._connected = value;
      this.trigger(event);
    }
    if (value === false) {
      this.trigger('offline-beacon');
    }
    return this._connected;
  }
}, {
  Views: {},
  Models: {},
  _typeof: 'Wheel.App',

  subclass: function(name, iprops, cprops) {
    this.children = this.children || [];
    var klass = this._super(name, iprops, cprops);
    this.children.push(klass);
    return klass;
  },

  start: function() {
    this.children && $.each(this.children, function(i, klass) {
      klass.build();
    });
  }
});
<commit_msg>more modular app setup for easy override of important methods<commit_after>Wheel.Class('Wheel.App', {
  _preInit: function(opts) {
    this._super(opts);
    this.initApp();
    this._class.app = this;
    this._class.App = this._class;
  },

  initApp: function() {
    this.buildEventManager();
    this.buildAndLoadTemplates();
  },

  buildEventManager: function() {
    this.eventManager = Modernizr.touch ? Wheel.TouchManager.build() : Wheel.MouseManager.build();
  },

  buildAndLoadTemplates: function() {
    this.templates = Wheel.Templates.build();
    this.templates.gather(); // no harm, no foul
  },

  manageRequests: function() {
    this.connectionChecker = Wheel.Utils.ConnectionChecker.build();
    this.requestQueue = Wheel.Utils.RequestQueue.build({app: this});

    this.connectionChecker.on('offline', function() {
      this.connected(false);
    }.bind(this));

    this.connectionChecker.on('online', function() {
      this.connected(true);
    }.bind(this));
  },

  checkConnection: function() {
    if ( ('onLine' in navigator) && (navigator.onLine == false)) {
      this.connected(false);
    } else {
      this.connectionChecker.test();
    }
  },

  connected: function(value) {
    if (value != undefined && this._connected != value) {
      var event = value ? 'online' : 'offline';
      this._connected = value;
      this.trigger(event);
    }
    if (value === false) {
      this.trigger('offline-beacon');
    }
    return this._connected;
  }
}, {
  Views: {},
  Models: {},
  _typeof: 'Wheel.App',

  subclass: function(name, iprops, cprops) {
    this.children = this.children || [];
    var klass = this._super(name, iprops, cprops);
    this.children.push(klass);
    return klass;
  },

  start: function() {
    this.children && $.each(this.children, function(i, klass) {
      klass.build();
    });
  }
});

{'fraction_non_alphanumeric': 0.16581487791027824, 'fraction_numerical': 0.0, 'mean_word_length': 3.0681293302540418, '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': '590464', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1119, 'n_words': 203}