src/debug/registry.js
function registerView(view) {
  var name = view.getDebugName();
  var wrapped = new RegistryWrapper(view, 'views');
  flatRegistry.views[name] = wrapped;
  if (!view.parentView && !view.isComponentView) {
    nestedRegistry.views[name] = wrapped;
  }
  if (typeof view.destroy === 'function') {
    wrapped.destroy = _.bind(view.destroy, view);
    view.destroy = _.bind(function() {
      var name = this.obj.getDebugName();
      delete nestedRegistry.views[name];
      delete flatRegistry.views[name];
      updateNestedModels();
      triggerChange();
      this.destroy();
    }, wrapped);
  }
  updateNestedModels();
  triggerChange();
}
function registerView(view) {
  var name = view.getDebugName();
  var wrapped = new RegistryWrapper(view, 'views');
  flatRegistry.views[name] = wrapped;
  if (!view.parentView && !view.isComponentView) {
    nestedRegistry.views[name] = wrapped;
  }
  if (typeof view.destroy === 'function') {
    wrapped.destroy = _.bind(view.destroy, view);
    view.destroy = _.bind(function() {
      var name = this.obj.getDebugName();
      delete nestedRegistry.views[name];
      delete flatRegistry.views[name];
      updateNestedModels();
      triggerChange();
      this.destroy();
    }, wrapped);
  }
  updateNestedModels();
  triggerChange();
}
function registerView ( view ) { var name = view . getDebugName ( ) ; var wrapped = new RegistryWrapper ( view , 'views' ) ; flatRegistry . views [ name ] = wrapped ; if ( ! view . parentView && ! view . isComponentView ) { nestedRegistry . views [ name ] = wrapped ; } if ( typeof view . destroy === 'function' ) { wrapped . destroy = _ . bind ( view . destroy , view ) ; view . destroy = _ . bind ( function ( ) { var name = this . obj . getDebugName ( ) ; delete nestedRegistry . views [ name ] ; delete flatRegistry . views [ name ] ; updateNestedModels ( ) ; triggerChange ( ) ; this . destroy ( ) ; } , wrapped ) ; } updateNestedModels ( ) ; triggerChange ( ) ; }
Adds a View to the registry

@param  {Object} view View to register
Adds a View to the registry