Skip to content

Commit

Permalink
added comments to world.js methods
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdmiller committed Jun 15, 2014
1 parent 43d8f10 commit 34432f7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ var World = module.exports = Class.extend({
return this._families[familyId].entityRemoved;
},

/**
* Creates a family for the passed array of component names if it does not
* exist already.
* @param {Array.<String>} components
*/
_ensureFamilyExists: function(components) {
var families = this._families;
var familyId = this._getFamilyId(components);
Expand All @@ -180,6 +185,13 @@ var World = module.exports = Class.extend({
}
},

/**
* Returns the family ID for the passed array of component names. A family
* ID is a comma separated string of all component names with a '$'
* prepended.
* @param {Array.<String>} components
* @return {String} The family ID for the passed array of components.
*/
_getFamilyId: function(components) {
return '$' + Array.prototype.join.call(components, ',');
},
Expand Down

0 comments on commit 34432f7

Please sign in to comment.