From 8ffecf69872716a2adacad7afa3aa1d79a9c11d1 Mon Sep 17 00:00:00 2001 From: Aki Rodic Date: Tue, 26 Aug 2014 18:01:16 -0700 Subject: [PATCH] added demo simplified bind --- demo.html | 49 +++++++++++++++++++ elements/controller-base/controller-base.html | 2 +- elements/controller-base/controller-base.js | 28 ++++++----- 3 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 demo.html diff --git a/demo.html b/demo.html new file mode 100644 index 0000000..dd8024c --- /dev/null +++ b/demo.html @@ -0,0 +1,49 @@ + + + + + + +dat-gui + + + + + + + + + + + + + + \ No newline at end of file diff --git a/elements/controller-base/controller-base.html b/elements/controller-base/controller-base.html index 5aebdbc..ca724b6 100644 --- a/elements/controller-base/controller-base.html +++ b/elements/controller-base/controller-base.html @@ -2,4 +2,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/elements/controller-base/controller-base.js b/elements/controller-base/controller-base.js index 9fb976c..312fefc 100644 --- a/elements/controller-base/controller-base.js +++ b/elements/controller-base/controller-base.js @@ -26,31 +26,33 @@ Polymer('controller-base', { this.object = object; this.path = path; - if ( this._observer ) { - this._observer.close(); - delete this._observer; - } + // if ( this._observer ) { + // this._observer.close(); + // delete this._observer; + // } - var _this = this; + this.bind('value', new PathObserver(this.object, this.path)); - this._observer = new PathObserver( this.object, this.path ); - this._observer.open( function( newValue ) { + // var _this = this; - _this.value = newValue; + // this._observer = new PathObserver( this.object, this.path ); + // this._observer.open( function( newValue ) { - } ); + // _this.value = newValue; - this.value = this.object[ this.path ]; + // } ); + + // this.value = this.object[ this.path ]; }, valueChanged: function() { - if ( this._observer ) { + // if ( this._observer ) { - Path.get( this.path ).setValueFrom( this.object, this.value ); + // Path.get( this.path ).setValueFrom( this.object, this.value ); - } + // } this.update();