UNPKG

electron-devtools-vendor

Version:

<div align="center"> <h2>electron-devtools-vendor</h2> <img alt="MIT" src="https://img.shields.io/github/license/BlackHole1/electron-devtools-vendor?color=9cf&style=flat-square"> <img alt="GitHub repo size" src="https://img.shields.io/github/r

43 lines (31 loc) 1.16 kB
Modules.set('models.Model', function() { // imports var Component = Modules.get('Component'); var u = Modules.get('utils'); var Model = Component.extend({ constructor: function(attributes, options) { attributes = attributes || {}; options = options || {}; var defaults = typeof this.defaults == 'function' ? this.defaults() : this.defaults; defaults = defaults || {}; this.attributes = {}; u.extend(this.attributes, defaults); u.extend(this.attributes, attributes); this.changed = {}; this.initialize.apply(this, arguments); }, set: function(name, value) { this.attributes[name] = value; u.each(this.changed, function(value, attribute) { delete this.changed[attribute]; }, this); this.changed[name] = value; this.trigger('change:'+name, this, value); this.trigger('change', this); }, get: function(name) { return this.attributes[name]; } }); return Model; });