Sha256: b144824847684cb0edec724e7e2a1e2dc7cd6a9978b3a85c2a35c27d4f86dd17
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
var _ = require('../util') var objProto = Object.prototype /** * Add a new property to an observed object * and emits corresponding event * * @param {String} key * @param {*} val * @public */ _.define( objProto, '$add', function $add (key, val) { if (this.hasOwnProperty(key)) return var ob = this.__ob__ if (!ob || _.isReserved(key)) { this[key] = val return } ob.convert(key, val) if (ob.vms) { var i = ob.vms.length while (i--) { var vm = ob.vms[i] vm._proxy(key) vm._digest() } } else { ob.notify() } } ) /** * Deletes a property from an observed object * and emits corresponding event * * @param {String} key * @public */ _.define( objProto, '$delete', function $delete (key) { if (!this.hasOwnProperty(key)) return delete this[key] var ob = this.__ob__ if (!ob || _.isReserved(key)) { return } if (ob.vms) { var i = ob.vms.length while (i--) { var vm = ob.vms[i] vm._unproxy(key) vm._digest() } } else { ob.notify() } } )
Version data entries
4 entries across 4 versions & 1 rubygems