torso-bundle.js
function responseCallback(response, model, success) {
        // Add response to a hash that will eventually be returned through the promise
        responses[model.cid] = {
            success: success,
            response: response
          };
        // If we have reached the total of number of expected responses, then resolve or reject the promise
        if (responsesFailed + responsesSucceeded === numberOfSaves) {
          if (responsesFailed > 0) {
            // Rollback if any responses have failed
            if (options.rollback) {
              _.each(formModel.getTrackedModels(), function(model) {
                model.set(oldValues[model.cid]);
                if (responses[model.cid].success) {
                  model.save();
                }
              });
            }
            formModel.trigger('save-fail', responses);
            deferred.reject(responses);
          } else {
            formModel.trigger('save-success', responses);
            deferred.resolve(responses);
          }
        }
      }
function responseCallback(response, model, success) {
        // Add response to a hash that will eventually be returned through the promise
        responses[model.cid] = {
            success: success,
            response: response
          };
        // If we have reached the total of number of expected responses, then resolve or reject the promise
        if (responsesFailed + responsesSucceeded === numberOfSaves) {
          if (responsesFailed > 0) {
            // Rollback if any responses have failed
            if (options.rollback) {
              _.each(formModel.getTrackedModels(), function(model) {
                model.set(oldValues[model.cid]);
                if (responses[model.cid].success) {
                  model.save();
                }
              });
            }
            formModel.trigger('save-fail', responses);
            deferred.reject(responses);
          } else {
            formModel.trigger('save-success', responses);
            deferred.resolve(responses);
          }
        }
      }
function responseCallback ( response , model , success ) { // Add response to a hash that will eventually be returned through the promise responses [ model . cid ] = { success : success , response : response } ; // If we have reached the total of number of expected responses, then resolve or reject the promise if ( responsesFailed + responsesSucceeded === numberOfSaves ) { if ( responsesFailed > 0 ) { // Rollback if any responses have failed if ( options . rollback ) { _ . each ( formModel . getTrackedModels ( ) , function ( model ) { model . set ( oldValues [ model . cid ] ) ; if ( responses [ model . cid ] . success ) { model . save ( ) ; } } ) ; } formModel . trigger ( 'save-fail' , responses ) ; deferred . reject ( responses ) ; } else { formModel . trigger ( 'save-success' , responses ) ; deferred . resolve ( responses ) ; } } }
Callback for each response
Callback for each response