This commit is contained in:
Adam Bradley
2015-06-25 10:52:13 -05:00
parent 3be98eb378
commit 1e5035c42d
4 changed files with 78 additions and 51 deletions

View File

@ -12,13 +12,6 @@ export class Platform {
return (this._platforms.indexOf(platformName) > -1);
}
platforms(val) {
if (arguments.length) {
this._platforms = val;
}
return this._platforms;
}
settings(val) {
if (arguments.length) {
this._settings = val;
@ -39,6 +32,12 @@ export class Platform {
this._platforms.push(platformName);
}
platforms() {
// get the array of active platforms, which also knows the hierarchy,
// with the last one the most important
return this._platforms;
}
/* Static Methods */
static create(app) {
@ -81,17 +80,23 @@ export class Platform {
let platform = new Platform();
if (rootNode) {
let platformNode = rootNode.child();
let platformNode = rootNode;
while (platformNode) {
insertSuperset(platformNode);
platformNode = platformNode.child();
}
platformNode = rootNode.child();
platformNode = rootNode;
let settings = {};
while (platformNode) {
// set the array of active platforms with
// the last one in the array the most important
platform.add(platformNode.name());
util.extend(settings, platformNode.settings());
// copy default platform settings into this platform settings obj
settings[platformNode.name()] = util.extend({}, platformNode.settings());
// go to the next child
platformNode = platformNode.child();
}