Add documentation for common functions
Add documentation for common functions
diff --git a/game.js b/game.js
index 6f22939..f1eb61d 100644
--- a/game.js
+++ b/game.js
@@ -9,24 +9,32 @@
* Frise Game Library
*/
/**
- *
+ * Common Global Functions
*/
/**
- *
+ * Returns an Element object from the current document which has the provided
+ * id.
+ * @param {String} id of element trying to get an object for
+ * @return {Element} desired element if exists, else null
*/
function elt(id)
{
return document.getElementById(id);
}
/**
- *
+ * Returns a collection of objects for Element's that match the provided Element
+ * name in the current document.
+ * @param {String} name of HTML/XML Element that want from current document
+ * @return {HTMLCollection} of matching Element's
*/
function tag(name)
{
return document.getElementsByTagName(name);
}
/**
- *
+ * Returns a list of Node's which match the CSS selector string provided.
+ * @param {String} a CSS selector string to match against current document
+ * @return {NodeList} of matching Element's
*/
function sel(selector)
{
@@ -88,8 +96,8 @@ function makeGameObjects(tag_objects)
}
/**
* Upper cases first letter of a string
- * @param String str string to upper case first letter of
- * @return String result of uppercasing
+ * @param {String} str string to upper case first letter of
+ * @return {String} result of upper-casing
*/
function upperFirst(str)
{
@@ -101,7 +109,7 @@ function upperFirst(str)
}
/**
* Used as part of the closure of makeGameObject so as that every game
- * object has an id.
+ * object has an integer id.
*/
var object_counter = 0;
function makeGameObject(dom_object)
@@ -154,6 +162,9 @@ function makeGameObject(dom_object)
game_object.type = type;
return game_object;
}
+/**
+ *
+ */
function toggleDisplay(id, display_type)
{
if (display_type === undefined) {
@@ -172,6 +183,9 @@ function toggleDisplay(id, display_type)
obj.setAttribute('aria-hidden', false);
}
}
+/**
+ *
+ */
function toggleOptions(elt_id, stop_pos)
{
let game_content = elt('game-content');
@@ -285,6 +299,9 @@ function interpolateVariables(text)
}
return text;
}
+/**
+ *
+ */
class Location
{
present = [];
@@ -394,6 +411,9 @@ class Location
return section;
}
}
+/**
+ *
+ */
class Game
{
timestamp;