Add Tag handler. Also convert all tabs to spaces.
[blerg.git] / www / jssrc / blerg / Main.js
index 4c1fa27..686b86c 100644 (file)
@@ -1,16 +1,24 @@
 enyo.kind({
-       name: "blerg.Main",
-       kind: "Control",
-       classes: "blerg-main",
-       currentView: null,
-       updateView: function(objdef) {
-               if (!this.currentView || objdef.kind != this.currentView.kind) {
-                       this.destroyComponents();
-                       this.currentView = this.createComponent(objdef);
-                       this.currentView.render();
-               } else {
-                       for (var i in objdef)
-                               this.currentView.setProperty(i, objdef[i])
-               }
-       }
+    name: "blerg.Main",
+    kind: "Control",
+    classes: "blerg-main",
+    currentView: null,
+    updateView: function(objdef) {
+        if (!this.currentView || objdef.kind != this.currentView.kind) {
+            this.destroyComponents();
+            this.currentView = this.createComponent(objdef);
+            this.currentView.render();
+        } else {
+            // We don't want to invoke any change handlers until
+            // these are all set, so we do that ourselves
+            for (var i in objdef) {
+                if (i == 'kind') continue;
+                this.currentView[i] = objdef[i];
+            }
+            for (var i in objdef) {
+                if (i == 'kind') continue;
+                this.currentView[i + 'Changed'] && this.currentView[i + 'Changed']();
+            }
+        }
+    }
 });