build/knockout.app.js
function(_options){
      var self = this, //collection
          options = _options || {},
          success = options.success; //custom success function passed in _options

      options.success = function(data){
        var toAdd = [];

        for(var model in data){
          toAdd.push(data[model]);
        }

        self.reset(); //reset the collection
        if(toAdd.length > 0) self.add(toAdd);
        if(success) success(self, data);
      };

      return this.sync.call(this, 'fetch', this, options);
    }
function(_options){
      var self = this, //collection
          options = _options || {},
          success = options.success; //custom success function passed in _options

      options.success = function(data){
        var toAdd = [];

        for(var model in data){
          toAdd.push(data[model]);
        }

        self.reset(); //reset the collection
        if(toAdd.length > 0) self.add(toAdd);
        if(success) success(self, data);
      };

      return this.sync.call(this, 'fetch', this, options);
    }
function ( _options ) { var self = this , //collection options = _options || { } , success = options . success ; //custom success function passed in _options options . success = function ( data ) { var toAdd = [ ] ; for ( var model in data ) { toAdd . push ( data [ model ] ) ; } self . reset ( ) ; //reset the collection if ( toAdd . length > 0 ) self . add ( toAdd ) ; if ( success ) success ( self , data ) ; } ; return this . sync . call ( this , 'fetch' , this , options ) ; }
Fetch models from server and add them to the collection. Options for the sync method can be passed as an object
Fetch models from server and add them to the collection . Options for the sync method can be passed as an object