-
Notifications
You must be signed in to change notification settings - Fork 0
/
backbone-viewstate-min.js
2 lines (2 loc) · 1.08 KB
/
backbone-viewstate-min.js
1
2
(function(e,t){if(typeof define==="function"&&define.amd){define(["underscore","backbone"],function(n,i){t(e,n,i)})}else if(typeof exports!=="undefined"){var n=require("underscore");var i=require("backbone");t(e,n,i)}else{t(e,e._,e.Backbone)}})(this,function(e,t,n){var i=n.ViewState=function(e){var n=e||{};this.attributes=t.clone(n)};t.extend(i.prototype,n.Events,{get:function(e){return this.attributes[e]},getAttributes:function(){return t.clone(this.attributes)},set:function(e,n,i){var r,s,u,o,f,a=[];if(e===null){return this}if(typeof e==="object"){r=e;i=n}else{(r={})[e]=n}i||(i={});f=i.unset;o=i.silent;u=this.attributes;for(s in r){n=r[s];if(!t.isEqual(u[s],n)){a.push(s)}if(f){delete u[s]}else{u[s]=n}}if(!o){for(var c=0,h=a.length;c<h;c++){this.trigger("change:"+a[c],this,u[a[c]],i)}this.trigger("change",this,i)}return this},unset:function(e,n){return this.set(e,void 0,t.extend({},n,{unset:true}))},clear:function(e){var n={};for(var i in this.attributes){n[i]=void 0}return this.set(n,t.extend({},e,{unset:true}))}});return n.ViewState});
//# sourceMappingURL=backbone-viewstate-min.map