1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
define([ 'backbone' ], function (Backbone) { return Backbone.Model.extend({ idAttribute: 'property', defaults: { enabled: false }, getValues: function () { return this.get('values') || []; }, toggle: function () { var enabled = this.get('enabled'); this.set({ enabled: !enabled }); } }); });