examples/bower_components/polymer/polymer.js
function(name, observable, resolveFn) {
      var privateName = name + '_';
      var privateObservable  = name + 'Observable_';
      // Present for properties which are computed and published and have a
      // bound value.
      var privateComputedBoundValue = name + 'ComputedBoundObservable_';
      this[privateObservable] = observable;
      var oldValue = this[privateName];
      // observable callback
      var self = this;
      function updateValue(value, oldValue) {
        self[privateName] = value;
        var setObserveable = self[privateComputedBoundValue];
        if (setObserveable && typeof setObserveable.setValue == 'function') {
          setObserveable.setValue(value);
        }
        self.emitPropertyChangeRecord(name, value, oldValue);
      }
      // resolve initial value
      var value = observable.open(updateValue);
      if (resolveFn && !areSameValue(oldValue, value)) {
        var resolvedValue = resolveFn(oldValue, value);
        if (!areSameValue(value, resolvedValue)) {
          value = resolvedValue;
          if (observable.setValue) {
            observable.setValue(value);
          }
        }
      }
      updateValue(value, oldValue);
      // register and return observable
      var observer = {
        close: function() {
          observable.close();
          self[privateObservable] = undefined;
          self[privateComputedBoundValue] = undefined;
        }
      };
      this.registerObserver(observer);
      return observer;
    }
function(name, observable, resolveFn) {
      var privateName = name + '_';
      var privateObservable  = name + 'Observable_';
      // Present for properties which are computed and published and have a
      // bound value.
      var privateComputedBoundValue = name + 'ComputedBoundObservable_';
      this[privateObservable] = observable;
      var oldValue = this[privateName];
      // observable callback
      var self = this;
      function updateValue(value, oldValue) {
        self[privateName] = value;
        var setObserveable = self[privateComputedBoundValue];
        if (setObserveable && typeof setObserveable.setValue == 'function') {
          setObserveable.setValue(value);
        }
        self.emitPropertyChangeRecord(name, value, oldValue);
      }
      // resolve initial value
      var value = observable.open(updateValue);
      if (resolveFn && !areSameValue(oldValue, value)) {
        var resolvedValue = resolveFn(oldValue, value);
        if (!areSameValue(value, resolvedValue)) {
          value = resolvedValue;
          if (observable.setValue) {
            observable.setValue(value);
          }
        }
      }
      updateValue(value, oldValue);
      // register and return observable
      var observer = {
        close: function() {
          observable.close();
          self[privateObservable] = undefined;
          self[privateComputedBoundValue] = undefined;
        }
      };
      this.registerObserver(observer);
      return observer;
    }
function ( name , observable , resolveFn ) { var privateName = name + '_' ; var privateObservable = name + 'Observable_' ; // Present for properties which are computed and published and have a // bound value. var privateComputedBoundValue = name + 'ComputedBoundObservable_' ; this [ privateObservable ] = observable ; var oldValue = this [ privateName ] ; // observable callback var self = this ; function updateValue ( value , oldValue ) { self [ privateName ] = value ; var setObserveable = self [ privateComputedBoundValue ] ; if ( setObserveable && typeof setObserveable . setValue == 'function' ) { setObserveable . setValue ( value ) ; } self . emitPropertyChangeRecord ( name , value , oldValue ) ; } // resolve initial value var value = observable . open ( updateValue ) ; if ( resolveFn && ! areSameValue ( oldValue , value ) ) { var resolvedValue = resolveFn ( oldValue , value ) ; if ( ! areSameValue ( value , resolvedValue ) ) { value = resolvedValue ; if ( observable . setValue ) { observable . setValue ( value ) ; } } } updateValue ( value , oldValue ) ; // register and return observable var observer = { close : function ( ) { observable . close ( ) ; self [ privateObservable ] = undefined ; self [ privateComputedBoundValue ] = undefined ; } } ; this . registerObserver ( observer ) ; return observer ; }
NOTE property `name` must be published. This makes it an accessor.
NOTE property name must be published . This makes it an accessor .