lib/observe-utils.js
function defineObservableProperty(target, property, originalValue) {

        //we store the value in an non-enumerable property with generated unique name
        var internalPropName = '_' + (uidCounter++) + property;

        if (target.hasOwnProperty(property)) {
            Object.defineProperty(target, internalPropName, {
                value: originalValue,
                writable: true,
                enumerable: false,
                configurable: true
            });
        }

        //then we create accessor method for our 'hidden' property,
        // that dispatch changesRecords when the value is updated
        Object.defineProperty(target, property, {
            get: function () {
                return this[internalPropName];
            },
            set: function (value) {
                if (!sameValue(value, this[internalPropName])) {
                    var oldValue = this[internalPropName];
                    Object.defineProperty(this, internalPropName, {
                        value: value,
                        writable: true,
                        enumerable: false,
                        configurable: true
                    });
                    var notifier = Object.getNotifier(this);
                    notifier.notify({ type: 'update', name: property, oldValue: oldValue });
                }
            },
            enumerable: true,
            configurable: true
        });
    }
function defineObservableProperty(target, property, originalValue) {

        //we store the value in an non-enumerable property with generated unique name
        var internalPropName = '_' + (uidCounter++) + property;

        if (target.hasOwnProperty(property)) {
            Object.defineProperty(target, internalPropName, {
                value: originalValue,
                writable: true,
                enumerable: false,
                configurable: true
            });
        }

        //then we create accessor method for our 'hidden' property,
        // that dispatch changesRecords when the value is updated
        Object.defineProperty(target, property, {
            get: function () {
                return this[internalPropName];
            },
            set: function (value) {
                if (!sameValue(value, this[internalPropName])) {
                    var oldValue = this[internalPropName];
                    Object.defineProperty(this, internalPropName, {
                        value: value,
                        writable: true,
                        enumerable: false,
                        configurable: true
                    });
                    var notifier = Object.getNotifier(this);
                    notifier.notify({ type: 'update', name: property, oldValue: oldValue });
                }
            },
            enumerable: true,
            configurable: true
        });
    }
function defineObservableProperty ( target , property , originalValue ) { //we store the value in an non-enumerable property with generated unique name var internalPropName = '_' + ( uidCounter ++ ) + property ; if ( target . hasOwnProperty ( property ) ) { Object . defineProperty ( target , internalPropName , { value : originalValue , writable : true , enumerable : false , configurable : true } ) ; } //then we create accessor method for our 'hidden' property, // that dispatch changesRecords when the value is updated Object . defineProperty ( target , property , { get : function ( ) { return this [ internalPropName ] ; } , set : function ( value ) { if ( ! sameValue ( value , this [ internalPropName ] ) ) { var oldValue = this [ internalPropName ] ; Object . defineProperty ( this , internalPropName , { value : value , writable : true , enumerable : false , configurable : true } ) ; var notifier = Object . getNotifier ( this ) ; notifier . notify ( { type : 'update' , name : property , oldValue : oldValue } ) ; } } , enumerable : true , configurable : true } ) ; }
Define a property on an object that will call the Notifier.notify method when updated
Define a property on an object that will call the Notifier . notify method when updated