<commit_before>var _ = require('underscore');
var View = require('ampersand-view');
var defaultTemplate = require('./lib/default-template');
var style = require('./lib/outfit');
var outerWidth = require('outerwidth');
var trigger = require('./lib/trigger');
var prefixedCalc = require('./lib/prefixed-calc');

module.exports = View.extend({
  props: {
    template: ['string', true, defaultTemplate()],
    drawerWidth: ['number', false, 256],
    responsiveWidth: ['number', false, 640],
    forceNarrow: ['boolean', false, false],
    rightDrawer: ['boolean', false, false],
    withHeader: ['boolean', false, false], // TODO: test this next!
    defaultNarrowClass: ['string', false , 'narrow'],
    main: 'object',
    drawer: 'object',
    toggle: 'object'
  },
  
  initialize: function () {
    
    // Resize listeners
    var resizeHandler = _.bind(this._handleWindowResize, this);
    window.addEventListener('resize', resizeHandler);
    this.once('remove', function () {
      
      // TODO: test this
      window.removeEventListener('resize', resizeHandler);
    });
    this.listenTo(this, 'resize', resizeHandler);
    
    this.render();
    
    return this;
  },
  
  render: function () {
    
    this.renderWithTemplate();
    
    // Query elements
    this.drawer = this.queryByHook('drawer');
    this.main = this.queryByHook('main');
    this.toggle = this.queryByHook('toggle');
    
    this._setDefaultStyles();
    
    if (this.forceNarrow) {
      this.el.classList.add(this.defaultNarrowClass);
    }
    
    _.defer(_.bind(function () {
      this.trigger('resize');<commit_msg>use autoRender built in<commit_after>var _ = require('underscore');
var View = require('ampersand-view');
var defaultTemplate = require('./lib/default-template');
var style = require('./lib/outfit');
var outerWidth = require('outerwidth');
var trigger = require('./lib/trigger');
var prefixedCalc = require('./lib/prefixed-calc');

module.exports = View.extend({
  
  autoRender: true,
  
  props: {
    template: ['string', true, defaultTemplate()],
    drawerWidth: ['number', false, 256],
    responsiveWidth: ['number', false, 640],
    forceNarrow: ['boolean', false, false],
    rightDrawer: ['boolean', false, false],
    withHeader: ['boolean', false, false], // TODO: test this next!
    defaultNarrowClass: ['string', false , 'narrow'],
    
    main: 'object',
    drawer: 'object',
    toggle: 'object'
  },
  
  initialize: function () {
    
    // Resize listeners
    var resizeHandler = _.bind(this._handleWindowResize, this);
    window.addEventListener('resize', resizeHandler);
    this.once('remove', function () {
      
      // TODO: test this
      window.removeEventListener('resize', resizeHandler);
    });
    this.listenTo(this, 'resize', resizeHandler);
    
    return this;
  },
  
  render: function () {
    
    this.renderWithTemplate();
    
    // Query elements
    this.drawer = this.queryByHook('drawer');
    this.main = this.queryByHook('main');
    this.toggle = this.queryByHook('toggle');
    
    this._setDefaultStyles();
    
    if (this.forceNarrow) {
      this.el.classList.add(this.defaultNarrowClass);
    }
    
    _.defer(_.bind(function () {
      this.trigger('resize');
{'fraction_non_alphanumeric': 0.16147919876733435, 'fraction_numerical': 0.0036979969183359015, 'mean_word_length': 3.2710526315789474, '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': '3591444', 'n_tokens_mistral': 978, 'n_tokens_neox': 963, 'n_words': 205}