Created
January 19, 2014 05:51
-
-
Save akiray03/8500931 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Fetch the default set of models for this collection, resetting the | |
| // collection when they arrive. If `reset: true` is passed, the response | |
| // data will be passed through the `reset` method instead of `set`. | |
| fetch: function(options) { | |
| options = options ? _.clone(options) : {}; | |
| if (options.parse === void 0) options.parse = true; | |
| var success = options.success; | |
| var collection = this; | |
| options.success = function(resp) { | |
| var method = options.reset ? 'reset' : 'set'; | |
| collection[method](resp, options); | |
| if (success) success(collection, resp, options); | |
| collection.trigger('sync', collection, resp, options); | |
| }; | |
| wrapError(this, options); | |
| return this.sync('read', this, options); | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment