examples/todos/js/backbonefire.js
function(model) {
          var remoteAttributes;
          var localAttributes;
          var updateAttributes;
          var ref;

          // if the model is already being handled by listeners then return
          if (model._remoteChanging) {
            return;
          }

          remoteAttributes = model._remoteAttributes || {};
          localAttributes = model.toJSON();

          // consolidate the updates to Firebase
          updateAttributes = this._compareAttributes(remoteAttributes, localAttributes);

          ref = this.firebase.ref().child(model.id);

          // if '.priority' is present setWithPriority
          // else do a regular update
          if (_.has(updateAttributes, '.priority')) {
            this._setWithPriority(ref, localAttributes);
          } else {
            this._updateToFirebase(ref, localAttributes);
          }

        }
function(model) {
          var remoteAttributes;
          var localAttributes;
          var updateAttributes;
          var ref;

          // if the model is already being handled by listeners then return
          if (model._remoteChanging) {
            return;
          }

          remoteAttributes = model._remoteAttributes || {};
          localAttributes = model.toJSON();

          // consolidate the updates to Firebase
          updateAttributes = this._compareAttributes(remoteAttributes, localAttributes);

          ref = this.firebase.ref().child(model.id);

          // if '.priority' is present setWithPriority
          // else do a regular update
          if (_.has(updateAttributes, '.priority')) {
            this._setWithPriority(ref, localAttributes);
          } else {
            this._updateToFirebase(ref, localAttributes);
          }

        }
function ( model ) { var remoteAttributes ; var localAttributes ; var updateAttributes ; var ref ; // if the model is already being handled by listeners then return if ( model . _remoteChanging ) { return ; } remoteAttributes = model . _remoteAttributes || { } ; localAttributes = model . toJSON ( ) ; // consolidate the updates to Firebase updateAttributes = this . _compareAttributes ( remoteAttributes , localAttributes ) ; ref = this . firebase . ref ( ) . child ( model . id ) ; // if '.priority' is present setWithPriority // else do a regular update if ( _ . has ( updateAttributes , '.priority' ) ) { this . _setWithPriority ( ref , localAttributes ) ; } else { this . _updateToFirebase ( ref , localAttributes ) ; } }
Add handlers for all models in this collection, and any future ones that may be added.
Add handlers for all models in this collection and any future ones that may be added .