lib/js/PageView.js
function() {
      var t = this,
          components = t.model.get('components'),
          canvas = t.$('.nm-pv-canvas');

      // Remove components not in the data model
      canvas.find('.nm-pv-component').each(function() {
        var component = $(this);
        if (!components.get(component.attr('id'))) {
          component.remove();
        }
      });

      // Add new components
      components.forEach(function(component) {
        var onScreen = t.$('#' + component.get('id'));
        if (!onScreen.length) {
          t.addComponent(component);
        }
      });

      // Center components onto the screen
      t.leftJustify();
      t.centerPage();
    }
function() {
      var t = this,
          components = t.model.get('components'),
          canvas = t.$('.nm-pv-canvas');

      // Remove components not in the data model
      canvas.find('.nm-pv-component').each(function() {
        var component = $(this);
        if (!components.get(component.attr('id'))) {
          component.remove();
        }
      });

      // Add new components
      components.forEach(function(component) {
        var onScreen = t.$('#' + component.get('id'));
        if (!onScreen.length) {
          t.addComponent(component);
        }
      });

      // Center components onto the screen
      t.leftJustify();
      t.centerPage();
    }
function ( ) { var t = this , components = t . model . get ( 'components' ) , canvas = t . $ ( '.nm-pv-canvas' ) ; // Remove components not in the data model canvas . find ( '.nm-pv-component' ) . each ( function ( ) { var component = $ ( this ) ; if ( ! components . get ( component . attr ( 'id' ) ) ) { component . remove ( ) ; } } ) ; // Add new components components . forEach ( function ( component ) { var onScreen = t . $ ( '#' + component . get ( 'id' ) ) ; if ( ! onScreen . length ) { t . addComponent ( component ) ; } } ) ; // Center components onto the screen t . leftJustify ( ) ; t . centerPage ( ) ; }
This adds and removes components from the page, updating component data models if necessary.
This adds and removes components from the page updating component data models if necessary .