From 34432f737ddf376dc39087f18763b9b7a20b1e16 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 15 Jun 2014 12:55:23 -0700 Subject: [PATCH] added comments to world.js methods --- src/world.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/world.js b/src/world.js index 3903caa..ecd3159 100644 --- a/src/world.js +++ b/src/world.js @@ -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.} components + */ _ensureFamilyExists: function(components) { var families = this._families; var familyId = this._getFamilyId(components); @@ -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.} components + * @return {String} The family ID for the passed array of components. + */ _getFamilyId: function(components) { return '$' + Array.prototype.join.call(components, ','); },