You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1001 lines
11 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: util</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: util</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".GameState"><span class="type-signature">(static, constant) </span>GameState<span class="type-signature"> :object</span></h4>
<div class="description">
Enum of all possible game states. These are player-agnostic.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line65">line 65</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".GridCellState"><span class="type-signature">(static, constant) </span>GridCellState<span class="type-signature"> :object</span></h4>
<div class="description">
Enum of all possible states of a grid cell.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".Player"><span class="type-signature">(static, constant) </span>Player<span class="type-signature"> :object</span></h4>
<div class="description">
Enum of all possible players.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line56">line 56</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".ShipType"><span class="type-signature">(static, constant) </span>ShipType<span class="type-signature"> :object</span></h4>
<div class="description">
The various supported ship types, by dimension.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line86">line 86</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".appUrl"><span class="type-signature">(static) </span>appUrl<span class="signature">(path)</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
Generate an absolute URL to a file w/in the project directory.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line123">line 123</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id=".clone"><span class="type-signature">(static) </span>clone<span class="signature">(obj)</span><span class="type-signature"> &rarr; {*}</span></h4>
<div class="description">
Makes a deep copy of the value passed in.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line103">line 103</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".isShipCell"><span class="type-signature">(static) </span>isShipCell<span class="signature">(grid_cell_state)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
Returns true if the given grid cell state represents a ship in some way.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>grid_cell_state</code></td>
<td class="type">
<span class="param-type">GridCellState</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id=".isValidTargetCell"><span class="type-signature">(static) </span>isValidTargetCell<span class="signature">(grid_cell_state)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
Returns true if the given grid cell state can be fired upon.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>grid_cell_state</code></td>
<td class="type">
<span class="param-type">GridCellState</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="module_util.js.html">module/util.js</a>, <a href="module_util.js.html#line45">line 45</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-errors.html">errors</a></li><li><a href="module-lang.html">lang</a></li><li><a href="module-sounds.html">sounds</a></li><li><a href="module-util.html">util</a></li></ul><h3>Classes</h3><ul><li><a href="GameBoardComponent.html">GameBoardComponent</a></li><li><a href="GameStateService.html">GameStateService</a></li><li><a href="GridCellComponent.html">GridCellComponent</a></li><li><a href="module-errors.InvalidAdvanceStateError.html">InvalidAdvanceStateError</a></li><li><a href="module-errors.InvalidMissileFireAttemptError.html">InvalidMissileFireAttemptError</a></li><li><a href="module-errors.InvalidShipPlacementError.html">InvalidShipPlacementError</a></li><li><a href="module-sounds-Sound.html">Sound</a></li><li><a href="ScoreBoardComponent.html">ScoreBoardComponent</a></li><li><a href="TopLevelComponent.html">TopLevelComponent</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Sat Sep 12 2020 16:40:09 GMT-0500 (Central Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>