dist/uncompressed/skylark-utils/models.js
function(event, entity, collection, options) {
      if (entity) {
        if ((event === 'add' || event === 'remove') && collection !== this) return;
        if (event === 'destroy') this.remove(entity, options);
        if (event === 'change') {
          var prevId = this.entityId(entity.previousAttributes());
          var id = this.entityId(entity.attributes);
          if (prevId !== id) {
            if (prevId != null) delete this._byId[prevId];
            if (id != null) this._byId[id] = entity;
          }
        }
      }
      this.trigger.apply(this, arguments);
    }
function(event, entity, collection, options) {
      if (entity) {
        if ((event === 'add' || event === 'remove') && collection !== this) return;
        if (event === 'destroy') this.remove(entity, options);
        if (event === 'change') {
          var prevId = this.entityId(entity.previousAttributes());
          var id = this.entityId(entity.attributes);
          if (prevId !== id) {
            if (prevId != null) delete this._byId[prevId];
            if (id != null) this._byId[id] = entity;
          }
        }
      }
      this.trigger.apply(this, arguments);
    }
function ( event , entity , collection , options ) { if ( entity ) { if ( ( event === 'add' || event === 'remove' ) && collection !== this ) return ; if ( event === 'destroy' ) this . remove ( entity , options ) ; if ( event === 'change' ) { var prevId = this . entityId ( entity . previousAttributes ( ) ) ; var id = this . entityId ( entity . attributes ) ; if ( prevId !== id ) { if ( prevId != null ) delete this . _byId [ prevId ] ; if ( id != null ) this . _byId [ id ] = entity ; } } } this . trigger . apply ( this , arguments ) ; }
Internal method called every time a entity in the set fires an event. Sets need to update their indexes when entities change ids. All other events simply proxy through. "add" and "remove" events that originate in other collections are ignored.
Internal method called every time a entity in the set fires an event . Sets need to update their indexes when entities change ids . All other events simply proxy through . add and remove events that originate in other collections are ignored .