757779dad0ed16a9c7f6054388dd27ee5881eec2
[blerg.git] / www / jssrc / blerg / Main.js
1 enyo.kind({
2         name: "blerg.Main",
3         kind: "Control",
4         classes: "blerg-main",
5         currentView: null,
6         updateView: function(objdef) {
7                 if (!this.currentView || objdef.kind != this.currentView.kind) {
8                         this.destroyComponents();
9                         this.currentView = this.createComponent(objdef);
10                         this.currentView.render();
11                 } else {
12                         // We don't want to invoke any change handlers until
13                         // these are all set, so we do that ourselves
14                         for (var i in objdef) {
15                                 if (i == 'kind') continue;
16                                 this.currentView[i] = objdef[i];
17                         }
18                         for (var i in objdef) {
19                                 if (i == 'kind') continue;
20                                 this.currentView[i + 'Changed'] && this.currentView[i + 'Changed']();
21                         }
22                 }
23         }
24 });