lfr-amd-loader
Version:
AMD Loader with support for combo URL and conditional loading
988 lines (306 loc) • 13.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: DependencyBuilder</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">Class: DependencyBuilder</h1>
<section>
<header>
<h2>
DependencyBuilder
</h2>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="DependencyBuilder"><span class="type-signature"></span>new DependencyBuilder<span class="signature">(configParser)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Creates an instance of DependencyBuilder class.
</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>configParser</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">instance of <a href="ConfigParser.html">ConfigParser</a> object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line12">line 12</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="_queue"><span class="type-signature"><protected> </span>_queue<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>_queue</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">List of modules, which dependencies should be resolved. Initially, it is copy of
the array of modules, passed for resolving; during the process more modules may be added to the queue. For
example, these might be conditional modules.</td>
</tr>
</tbody>
</table></dl>
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="dummy">
<li>[]</li>
</ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line193">line 193</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="_cleanup"><span class="type-signature"><protected> </span>_cleanup<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Clears the used resources during the process of resolving dependencies.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line53">line 53</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="_processConditionalModules"><span class="type-signature"><protected> </span>_processConditionalModules<span class="signature">(module)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Processes conditional modules. If a module has conditional module as dependency, this module will be added to
the list of modules, which dependencies should be resolved.
</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>module</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Module, which will be checked for conditional modules as dependencies.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line79">line 79</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="_resolveDependencies"><span class="type-signature"><protected> </span>_resolveDependencies<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Processes all modules in the <a href="DependencyBuilder.html#_queue">DependencyBuilder#_queue</a> and resolves their dependencies. The function
implements standard
<a href="http://en.wikipedia.org/wiki/Topological_sorting">topological sorting based on depth-first search</a>.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line107">line 107</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="_testConditionalModule"><span class="type-signature"></span>_testConditionalModule<span class="signature">(testFunction)</span><span class="type-signature"> → {boolean}</span></h4>
</dt>
<dd>
<div class="description">
Executes the test function of an conditional module and adds it to the list of module dependencies if the
function returns true.
</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>testFunction</code></td>
<td class="type">
<span class="param-type">function</span>
|
<span class="param-type">string</span>
</td>
<td class="description last">The function which have to be executed. May be Function object or string.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line128">line 128</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The result of the execution of the test function.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="_visit"><span class="type-signature"><protected> </span>_visit<span class="signature">(module)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Visits a module during the process of resolving dependencies. The function will throw exception in case of
circular dependencies among modules.
</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>module</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The module which have to be visited.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line143">line 143</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="resolveDependencies"><span class="type-signature"></span>resolveDependencies<span class="signature">(modules)</span><span class="type-signature"> → {array}</span></h4>
</dt>
<dd>
<div class="description">
Resolves modules dependencies.
</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>modules</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">List of modules which dependencies should be resolved.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dependency-builder.js.html">dependency-builder.js</a>, <a href="dependency-builder.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
List of module names, representing module dependencies. Module name itself is being returned too.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ConfigParser.html">ConfigParser</a></li><li><a href="DependencyBuilder.html">DependencyBuilder</a></li><li><a href="EventEmitter.html">EventEmitter</a></li><li><a href="Loader.html">Loader</a></li><li><a href="URLBuilder.html">URLBuilder</a></li></ul><h3>Events</h3><ul><li><a href="Loader.html#event:moduleRegister">moduleRegister</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jun 16 2015 17:51:36 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>