update getDependencies

beta.r3js.org
-=yb4f310 2017-10-27 11:00:11 +02:00
parent 84a98df77a
commit e2c307ec78
1 changed files with 16 additions and 14 deletions

View File

@ -97,6 +97,10 @@ GameLib.Component.prototype.createInstance = function() {
};
/**
* Dependencies are everything which is either a string or an object with an id which is linked to this object
* @returns {Array}
*/
GameLib.Component.prototype.getDependencies = function() {
var dependencies = [];
@ -113,26 +117,24 @@ GameLib.Component.prototype.getDependencies = function() {
}
if (this[property] instanceof Array) {
this[property].map(function(arrayProperty){
this[property].map(
function(arrayProperty) {
if (typeof arrayProperty === 'string') {
GameLib.Utils.PushUnique(dependencies, arrayProperty);
}
if (typeof arrayProperty === 'string') {
GameLib.Utils.PushUnique(dependencies, arrayProperty);
}
if (arrayProperty &&
typeof arrayProperty === 'object' &&
arrayProperty.hasOwnProperty('loaded') &&
arrayProperty.loaded === false
) {
GameLib.Utils.PushUnique(dependencies, arrayProperty.id);
if (arrayProperty &&
arrayProperty instanceof GameLib.Component
) {
GameLib.Utils.PushUnique(dependencies, arrayProperty.id);
}
}
});
);
}
if (this[property] &&
typeof this[property] === 'object' &&
this[property].hasOwnProperty('loaded') &&
this[property].loaded === false
this[property] instanceof GameLib.Component
) {
GameLib.Utils.PushUnique(dependencies, this[property].id);
}