UNPKG

lfr-amd-loader

Version:

AMD Loader with support for combo URL and conditional loading

3,383 lines (1,054 loc) 43.5 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Loader</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: Loader</h1> <section> <header> <h2> Loader </h2> </header> <article> <div class="container-overview"> <dt> <h4 class="name" id="Loader"><span class="type-signature"></span>new Loader<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Creates an instance of Loader class. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line3">line 3</a> </li></ul></dd> </dl> </dd> </div> <h3 class="subsection-title">Extends</h3> <ul> <li><a href="EventEmitter.html">EventEmitter</a></li> </ul> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name" id="_createModulePromise"><span class="type-signature">&lt;protected> </span>_createModulePromise<span class="signature">(moduleName)</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> Creates Promise for module. It will be resolved as soon as module is being loaded from server. </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>moduleName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The name of module for which Promise should be created.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line245">line 245</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Promise, which will be resolved as soon as the requested module is being loaded. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_filterNotRequestedModules"><span class="type-signature">&lt;protected> </span>_filterNotRequestedModules<span class="signature">(modules)</span><span class="type-signature"> &rarr; {array}</span></h4> </dt> <dd> <div class="description"> Filters a list of modules and returns only these which have been not yet requested for delivery via network. </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 which will be filtered.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line417">line 417</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of modules not yet requested for delivery via network. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">array</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_getConfigParser"><span class="type-signature">&lt;protected> </span>_getConfigParser<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="ConfigParser.html">ConfigParser</a>}</span></h4> </dt> <dd> <div class="description"> Returns instance of <a href="ConfigParser.html">ConfigParser</a> class. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line288">line 288</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Instance of <a href="ConfigParser.html">ConfigParser</a> class. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ConfigParser.html">ConfigParser</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="_getDependencyBuilder"><span class="type-signature">&lt;protected> </span>_getDependencyBuilder<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="DependencyBuilder.html">DependencyBuilder</a>}</span></h4> </dt> <dd> <div class="description"> Returns instance of <a href="DependencyBuilder.html">DependencyBuilder</a> class. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line303">line 303</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Instance of <a href="DependencyBuilder.html">DependencyBuilder</a> class. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="DependencyBuilder.html">DependencyBuilder</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="_getMissingDepenencies"><span class="type-signature">&lt;protected> </span>_getMissingDepenencies<span class="signature">(moduleNames)</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4> </dt> <dd> <div class="description"> Returns an array of all missing dependencies of the passed modules. A missing dependency is a dependency, which does not have pending implementation yet. </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>moduleNames</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="description last">List of module names to be checked for missing dependencies.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line332">line 332</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> A list with all missing dependencies. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;string></span> </dd> </dl> </dd> <dt> <h4 class="name" id="_getModuleImplementations"><span class="type-signature">&lt;protected> </span>_getModuleImplementations<span class="signature">(requiredModules)</span><span class="type-signature"> &rarr; {array}</span></h4> </dt> <dd> <div class="description"> Retrieves module implementations to an array. </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>requiredModules</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="description last">Lit of modules, which implementations will be added to an array.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line365">line 365</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of modules implementations. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">array</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_getPathResolver"><span class="type-signature">&lt;protected> </span>_getPathResolver<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="PathResolver.html">PathResolver</a>}</span></h4> </dt> <dd> <div class="description"> Returns an instance of <a href="PathResolver.html">PathResolver</a> class. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line386">line 386</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Instance of <a href="PathResolver.html">PathResolver</a> class. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="PathResolver.html">PathResolver</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="_getURLBuilder"><span class="type-signature">&lt;protected> </span>_getURLBuilder<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="URLBuilder.html">URLBuilder</a>}</span></h4> </dt> <dd> <div class="description"> Returns instance of <a href="URLBuilder.html">URLBuilder</a> class. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line401">line 401</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Instance of <a href="URLBuilder.html">URLBuilder</a> class. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="URLBuilder.html">URLBuilder</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="_getValueGlobalNS"><span class="type-signature">&lt;protected> </span>_getValueGlobalNS<span class="signature">(exports)</span><span class="type-signature"> &rarr; {Any}</span></h4> </dt> <dd> <div class="description"> Retrieves a value from the global namespace. </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>exports</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The key which should be used to retrieve the value.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line319">line 319</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The retrieved value. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Any</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_loadModules"><span class="type-signature">&lt;protected> </span>_loadModules<span class="signature">(modules)</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> Loads list of 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>modules</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="description last">List of modules to be loaded.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line443">line 443</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Promise, which will be resolved as soon as all module a being loaded. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_loadScript"><span class="type-signature">&lt;protected> </span>_loadScript<span class="signature">(url)</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> Loads a &ltscript&gt element on the page. </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>url</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The src of the script.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line501">line 501</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Promise which will be resolved as soon as the script is being loaded. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_resolveDependencies"><span class="type-signature">&lt;protected> </span>_resolveDependencies<span class="signature">(modules)</span><span class="type-signature"> &rarr; {Promise}</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="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line537">line 537</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Promise which will be resolved as soon as all dependencies are being resolved. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_setModuleImplementation"><span class="type-signature">&lt;protected> </span>_setModuleImplementation<span class="signature">(modules)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Invokes the implementation method of list of modules passing the implementations of its 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 to which implementation should be set.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line558">line 558</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="_waitForModule"><span class="type-signature">&lt;protected> </span>_waitForModule<span class="signature">(module)</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> Resolves a Promise as soon as all module dependencies are being resolved or it has implementation already. </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 for which this function should wait.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line632">line 632</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="_waitForModules"><span class="type-signature">&lt;protected> </span>_waitForModules<span class="signature">(modules)</span><span class="type-signature"> &rarr; {Promise}</span></h4> </dt> <dd> <div class="description"> Resolves a Promise as soon as all dependencies of all provided modules are being resolved and modules have implementations. </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 for which implementations this function should wait.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line657">line 657</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </dd> <dt> <h4 class="name" id="addModule"><span class="type-signature"></span>addModule<span class="signature">(module)</span><span class="type-signature"> &rarr; {Object}</span></h4> </dt> <dd> <div class="description"> Adds a module to the configuration. See <a href="ConfigParser.html#addModule">ConfigParser#addModule</a> for more details. </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 should be added to the configuration. See <a href="ConfigParser.html#addModule">ConfigParser#addModule</a> for more details.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line31">line 31</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Returns the added module to the configuration. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <dt> <h4 class="name" id="define"><span class="type-signature"></span>define<span class="signature">(name, dependencies, implementation, <span class="optional">config</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4> </dt> <dd> <div class="description"> Defines a module in the system and fires <a href="Loader.html#event:moduleRegister">Loader#event:moduleRegister</a> event with the registered module as param. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last">The name of the module.</td> </tr> <tr> <td class="name"><code>dependencies</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="attributes"> </td> <td class="description last">List of module dependencies.</td> </tr> <tr> <td class="name"><code>implementation</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="attributes"> </td> <td class="description last">The implementation of the module.</td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Object configuration: <ul> <strong>Optional properties</strong>: <li>path (String) - Explicitly set path of the module. If omitted, module name will be used as path</li> <li>condition (Object) Object which represents if the module should be added automatically after another module. It should have the following properties:</li> <ul> <li>trigger - the module, which should trigger the loading of the current module</li> <li>test - function, which should return true if module should be loaded</li> </ul> <li>exports - If the module does not expose a "define" function, then you can specify an "exports" property. The value of this property should be a string, which represents the value, which this module exports to the global namespace. For example: exports: '_'. This will mean the module exports an underscore to the global namespace. In this way you can load legacy modules. </li> </ul></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line61">line 61</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The constructed module. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <dt> <h4 class="name" id="emit"><span class="type-signature"></span>emit<span class="signature">(event, args)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Emits an event. The function calls all registered listeners in the order they have been added. The provided args param will be passed to each listener of the event. </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>event</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The name of the event.</td> </tr> <tr> <td class="name"><code>args</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">Object, which will be passed to the listener as only argument.</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="EventEmitter.html#emit">EventEmitter#emit</a> </li></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="event-emitter.js.html">event-emitter.js</a>, <a href="event-emitter.js.html#line57">line 57</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="getConditionalModules"><span class="type-signature"></span>getConditionalModules<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4> </dt> <dd> <div class="description"> Returns list of currently registered conditional modules. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line116">line 116</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of currently registered conditional modules. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">array</span> </dd> </dl> </dd> <dt> <h4 class="name" id="getModules"><span class="type-signature"></span>getModules<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4> </dt> <dd> <div class="description"> Returns list of currently registered modules. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line126">line 126</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of currently registered modules. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">array</span> </dd> </dl> </dd> <dt> <h4 class="name" id="off"><span class="type-signature"></span>off<span class="signature">(event, callback)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Removes an event from the list of event listeners to some event. </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>event</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The name of the event.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback method to be removed from the list of listeners.</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="EventEmitter.html#off">EventEmitter#off</a> </li></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="event-emitter.js.html">event-emitter.js</a>, <a href="event-emitter.js.html#line34">line 34</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="on"><span class="type-signature"></span>on<span class="signature">(event, callback)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Adds event listener to an event. </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>event</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The name of the event.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback method to be invoked when event is being emitted.</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="EventEmitter.html#on">EventEmitter#on</a> </li></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="event-emitter.js.html">event-emitter.js</a>, <a href="event-emitter.js.html#line22">line 22</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="require"><span class="type-signature"></span>require<span class="signature">(modules, success, failure)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Requires list of modules. If a module is not yet registered, it will be ignored and its implementation in the provided success callback will be left undefined.<br> </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> | <span class="param-type">Array.&lt;string></span> </td> <td class="description last">Modules can be specified as an array of strings or provided as multiple string parameters.</td> </tr> <tr> <td class="name"><code>success</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback, which will be invoked in case of success. The provided parameters will be implementations of all required modules.</td> </tr> <tr> <td class="name"><code>failure</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback, which will be invoked in case of failure. One parameter with information about the error will be provided.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line142">line 142</a> </li></ul></dd> </dl> </dd> </dl> <h3 class="subsection-title">Events</h3> <dl> <dt> <h4 class="name" id="event:moduleRegister">moduleRegister</h4> </dt> <dd> <div class="description"> Indicates that a module has been registered. </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 registered module.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="script-loader.js.html">script-loader.js</a>, <a href="script-loader.js.html#line699">line 699</a> </li></ul></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="PathResolver.html">PathResolver</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 Sun Dec 20 2015 08:52:39 GMT+0100 (CET) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>