Lines Matching refs:options

204   var onApi = function(events, name, callback, options) {  argument
207 var context = options.context, ctx = options.ctx, listening = options.listening;
250 var offApi = function(events, name, callback, options) { argument
254 var context = options.context, listeners = options.listeners;
394 var Model = Backbone.Model = function(attributes, options) { argument
396 options || (options = {});
400 if (options.collection) this.collection = options.collection;
401 if (options.parse) attrs = this.parse(attrs, options) || {};
404 this.set(attrs, options);
435 toJSON: function(options) { argument
469 set: function(key, val, options) { argument
476 options = val;
481 options || (options = {});
484 if (!this._validate(attrs, options)) return false;
487 var unset = options.unset;
488 var silent = options.silent;
519 if (changes.length) this._pending = options;
521 this.trigger('change:' + changes[i], this, current[changes[i]], options);
530 options = this._pending;
532 this.trigger('change', this, options);
542 unset: function(attr, options) { argument
543 return this.set(attr, void 0, _.extend({}, options, {unset: true}));
547 clear: function(options) { argument
550 return this.set(attrs, _.extend({}, options, {unset: true}));
595 fetch: function(options) { argument
596 options = _.extend({parse: true}, options);
598 var success = options.success;
599 options.success = function(resp) {
600 var serverAttrs = options.parse ? model.parse(resp, options) : resp;
601 if (!model.set(serverAttrs, options)) return false;
602 if (success) success.call(options.context, model, resp, options);
603 model.trigger('sync', model, resp, options);
605 wrapError(this, options);
606 return this.sync('read', this, options);
612 save: function(key, val, options) { argument
617 options = val;
622 options = _.extend({validate: true, parse: true}, options);
623 var wait = options.wait;
629 if (!this.set(attrs, options)) return false;
630 } else if (!this._validate(attrs, options)) {
637 var success = options.success;
639 options.success = function(resp) {
642 var serverAttrs = options.parse ? model.parse(resp, options) : resp;
644 if (serverAttrs && !model.set(serverAttrs, options)) return false;
645 if (success) success.call(options.context, model, resp, options);
646 model.trigger('sync', model, resp, options);
648 wrapError(this, options);
653 var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
654 if (method === 'patch' && !options.attrs) options.attrs = attrs;
655 var xhr = this.sync(method, this, options);
666 destroy: function(options) { argument
667 options = options ? _.clone(options) : {};
669 var success = options.success;
670 var wait = options.wait;
674 model.trigger('destroy', model, model.collection, options);
677 options.success = function(resp) {
679 if (success) success.call(options.context, model, resp, options);
680 if (!model.isNew()) model.trigger('sync', model, resp, options);
685 _.defer(options.success);
687 wrapError(this, options);
688 xhr = this.sync('delete', this, options);
709 parse: function(resp, options) { argument
724 isValid: function(options) { argument
725 return this._validate({}, _.extend({}, options, {validate: true}));
730 _validate: function(attrs, options) { argument
731 if (!options.validate || !this.validate) return true;
733 var error = this.validationError = this.validate(attrs, options) || null;
735 this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
762 var Collection = Backbone.Collection = function(models, options) { argument
763 options || (options = {});
765 if (options.model) this.model = options.model;
766 if (options.comparator !== void 0) this.comparator = options.comparator;
769 if (models) this.reset(models, _.extend({silent: true}, options));
805 toJSON: function(options) { argument
806 return this.map(function(model) { return model.toJSON(options); });
817 add: function(models, options) { argument
818 return this.set(models, _.extend({merge: false}, options, addOptions));
822 remove: function(models, options) { argument
823 options = _.extend({}, options);
826 var removed = this._removeModels(models, options);
827 if (!options.silent && removed.length) {
828 options.changes = {added: [], merged: [], removed: removed};
829 this.trigger('update', this, options);
838 set: function(models, options) { argument
841 options = _.extend({}, setOptions, options);
842 if (options.parse && !this._isModel(models)) {
843 models = this.parse(models, options) || [];
849 var at = options.at;
860 var add = options.add;
861 var merge = options.merge;
862 var remove = options.remove;
865 var sortable = this.comparator && at == null && options.sort !== false;
880 if (options.parse) attrs = existing.parse(attrs, options);
881 existing.set(attrs, options);
893 model = models[i] = this._prepareModel(model, options);
896 this._addReference(model, options);
909 if (toRemove.length) this._removeModels(toRemove, options);
932 if (!options.silent) {
934 if (at != null) options.index = at + i;
936 model.trigger('add', model, this, options);
938 if (sort || orderChanged) this.trigger('sort', this, options);
940 options.changes = {
945 this.trigger('update', this, options);
957 reset: function(models, options) { argument
958 options = options ? _.clone(options) : {};
960 this._removeReference(this.models[i], options);
962 options.previousModels = this.models;
964 models = this.add(models, _.extend({silent: true}, options));
965 if (!options.silent) this.trigger('reset', this, options);
970 push: function(model, options) { argument
971 return this.add(model, _.extend({at: this.length}, options));
975 pop: function(options) { argument
977 return this.remove(model, options);
981 unshift: function(model, options) { argument
982 return this.add(model, _.extend({at: 0}, options));
986 shift: function(options) { argument
988 return this.remove(model, options);
1031 sort: function(options) { argument
1034 options || (options = {});
1045 if (!options.silent) this.trigger('sort', this, options);
1057 fetch: function(options) { argument
1058 options = _.extend({parse: true}, options);
1059 var success = options.success;
1061 options.success = function(resp) {
1062 var method = options.reset ? 'reset' : 'set';
1063 collection[method](resp, options);
1064 if (success) success.call(options.context, collection, resp, options);
1065 collection.trigger('sync', collection, resp, options);
1067 wrapError(this, options);
1068 return this.sync('read', this, options);
1074 create: function(model, options) { argument
1075 options = options ? _.clone(options) : {};
1076 var wait = options.wait;
1077 model = this._prepareModel(model, options);
1079 if (!wait) this.add(model, options);
1081 var success = options.success;
1082 options.success = function(m, resp, callbackOpts) {
1086 model.save(null, options);
1092 parse: function(resp, options) { argument
1119 _prepareModel: function(attrs, options) { argument
1124 options = options ? _.clone(options) : {};
1125 options.collection = this;
1126 var model = new this.model(attrs, options);
1128 this.trigger('invalid', this, model.validationError, options);
1133 _removeModels: function(models, options) { argument
1149 if (!options.silent) {
1150 options.index = index;
1151 model.trigger('remove', model, this, options);
1155 this._removeReference(model, options);
1167 _addReference: function(model, options) { argument
1175 _removeReference: function(model, options) { argument
1187 _onModelEvent: function(event, model, collection, options) { argument
1190 if (event === 'destroy') this.remove(model, options);
1233 var View = Backbone.View = function(options) { argument
1236 _.extend(this, _.pick(options, viewOptions));
1406 Backbone.sync = function(method, model, options) { argument
1410 _.defaults(options || (options = {}), {
1419 if (!options.url) {
1424 …if (options.data == null && model && (method === 'create' || method === 'update' || method === 'pa…
1426 params.data = JSON.stringify(options.attrs || model.toJSON(options));
1430 if (options.emulateJSON) {
1437 if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
1439 if (options.emulateJSON) params.data._method = type;
1440 var beforeSend = options.beforeSend;
1441 options.beforeSend = function(xhr) {
1448 if (params.type !== 'GET' && !options.emulateJSON) {
1453 var error = options.error;
1454 options.error = function(xhr, textStatus, errorThrown) {
1455 options.textStatus = textStatus;
1456 options.errorThrown = errorThrown;
1457 if (error) error.call(options.context, xhr, textStatus, errorThrown);
1461 var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
1462 model.trigger('request', model, xhr, options);
1486 var Router = Backbone.Router = function(options) { argument
1487 options || (options = {});
1489 if (options.routes) this.routes = options.routes;
1544 navigate: function(fragment, options) { argument
1545 Backbone.history.navigate(fragment, options);
1681 start: function(options) { argument
1687 this.options = _.extend({root: '/'}, this.options, options);
1688 this.root = this.options.root;
1689 this._wantsHashChange = this.options.hashChange !== false;
1692 this._wantsPushState = !!this.options.pushState;
1751 if (!this.options.silent) return this.loadUrl();
1824 navigate: function(fragment, options) { argument
1826 if (!options || options === true) options = {trigger: !!options};
1849 this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
1854 this._updateHash(this.location, fragment, options.replace);
1861 if (!options.replace) {
1866 this._updateHash(iWindow.location, fragment, options.replace);
1874 if (options.trigger) return this.loadUrl(fragment);
1937 var wrapError = function(model, options) { argument
1938 var error = options.error;
1939 options.error = function(resp) {
1940 if (error) error.call(options.context, model, resp, options);
1941 model.trigger('error', model, resp, options);