nodePong/client/lib/core/page_base.js

54 lines
920 B
JavaScript
Raw Normal View History

2016-02-14 00:49:19 +11:00
/**
* @file AppPage.js
* @author frtk@tetalab
*/
NPGClient.AppPage = function(n) {
Object.defineProperty(this, 'id', { value: NPGClient.pageCount++ });
this.name = n || '';
2016-02-14 07:06:40 +11:00
this.idx = NPGClient.pageCount;
2016-02-14 00:49:19 +11:00
// ui elements
this.uiElems = [];
};
NPGClient.AppPage.prototype = {
constructor: NPGClient.AppPage,
//
2016-02-14 07:06:40 +11:00
addUIObject: function(c) {
2016-02-14 00:49:19 +11:00
var self = this;
2016-02-14 07:06:40 +11:00
self.uiElems.push(c);
2016-02-14 00:49:19 +11:00
},
//
2016-02-14 07:06:40 +11:00
getUIElems: function() {
2016-02-14 00:49:19 +11:00
var self = this;
2016-02-14 07:06:40 +11:00
return self.uiElems;
2016-02-14 00:49:19 +11:00
},
//
getUIElemByName: function(name) {
var self = this;
if (self.uiElems.length > 0) {
for (var i = 0; i < self.uiElems.length; i++)
if (self.uiElems[i].name == name) return self.uiElems[i];
}
return undefined;
},
2016-02-14 07:06:40 +11:00
//
printInfo: function() {
2016-02-14 00:49:19 +11:00
var self = this;
2016-02-14 07:06:40 +11:00
console.log('[NPGClient.AppPage] name:' + self.name + ', nUIElems=' + self.pages.length);
2016-02-14 00:49:19 +11:00
2016-02-14 07:06:40 +11:00
}
2016-02-14 00:49:19 +11:00
};