UNPKG

ancient-funicular

Version:

Just async mounting, updating and unmounting hierarchical carriages.

1,854 lines (484 loc) 25.5 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Carriage - Documentation</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="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html">Carriage</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#disable">disable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#enable">enable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#mount">mount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#mountChild">mountChild</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#remount">remount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#shouldRemount">shouldRemount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#tieChild">tieChild</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#unique">unique</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#unmount">unmount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#unmountChilds">unmountChilds</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Carriage.html#untieChild">untieChild</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="ancient-funicular.Funicular.html">Funicular</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ancient-funicular.Funicular.html#mount">mount</a></span></li><li class="nav-heading">Modules</li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-ancient-funicular.html">ancient-funicular</a></span></li><li class="nav-heading">Interfaces</li><li class="nav-heading"><span class="nav-item-type type-interface">I</span><span class="nav-item-name"><a href="module-ancient-funicular-CarriageListsByNames.html">CarriageListsByNames</a></span></li><li class="nav-heading"><span class="nav-item-type type-interface">I</span><span class="nav-item-name"><a href="module-ancient-funicular-CarriagesByIds.html">CarriagesByIds</a></span></li><li class="nav-heading"><span class="nav-item-type type-interface">I</span><span class="nav-item-name"><a href="module-ancient-funicular-CarriagesByNames.html">CarriagesByNames</a></span></li> </nav> <div id="main"> <h1 class="page-title">Carriage</h1> <section> <header> <h2> Carriage </h2> <div class="class-description"><p>Universal basic carriage for funicular.</p></div> </header> <article> <div class="container-overview"> <div class="section-method"> <h2>Constructor</h2> <h4 class="name" id="Carriage"><span class="type-signature"></span>new Carriage<span class="signature">(funicular, name, data)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line7">line 7</a> </li></ul></dd> </dl> <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>funicular</code></td> <td class="type"> <span class="param-type"><code>Funicular</code></span> </td> <td class="description last"> <p>Link to instance of Funicular, used as namespace of carriages for this carriage.</p> </td> </tr> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type"><code>String</code></span> </td> <td class="description last"> <p>Unique name of this carriage.</p> </td> </tr> <tr> <td class="name"><code>data</code></td> <td class="type"> </td> <td class="description last"> <p>Any outer system data needed for mounting one carriage.</p> </td> </tr> </tbody> </table> </div> </div> <h3 class="subsection-title">Methods</h3> <div class="section-method"> <h4 class="name" id="disable"><span class="type-signature"></span>disable<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>You must override it with useful functionality. It method must forget, disable, stop and erase all that was added, enabled, runned and writed at Carriage.enable. It must call callback! Otherwise, the demounting chain may break.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line310">line 310</a> </li></ul></dd> </dl> <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>callback</code></td> <td class="type"> <span class="param-type"><code><a href="Carriage.html#~disableCallback">Carriage~disableCallback</a></code></span> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="enable"><span class="type-signature"></span>enable<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>You must override it with useful functionality. Can gets and mount childs carriages into Carriage.childs. It method must added, enable, run and write all that was forgeted, disabled, stoped and erased at Carriage.disable. It must call callback! Otherwise, the demounting chain may break.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line217">line 217</a> </li></ul></dd> </dl> <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>callback</code></td> <td class="type"> <span class="param-type"><code><a href="Carriage.html#~enableCallback">Carriage~enableCallback</a></code></span> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="mount"><span class="type-signature"></span>mount<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Based on data, mount this carriage. Use Carriage.enable for useful functionality. Calls all functions from Carriage.mountedCallbacks, if this carriage did unmount.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line166">line 166</a> </li></ul></dd> </dl> </div> <div class="section-method"> <h4 class="name" id="mountChild"><span class="type-signature"></span>mountChild<span class="signature">(name, data, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> <p>Mount carriage as child for this carriage.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line191">line 191</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type"><code>String</code></span> </td> <td class="attributes"> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>data</code></td> <td class="type"> </td> <td class="attributes"> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><code>Carriage~mountCallback</code></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="remount"><span class="type-signature"></span>remount<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Remount this carriage.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line231">line 231</a> </li></ul></dd> <dt class="tag-todo">To Do:</dt> <dd class="tag-todo"> <ul> <li>If Carriage.invalid is `true`, mount new carriage based on this name and data and unmount this carriage.</li> </ul> </dd> </dl> </div> <div class="section-method"> <h4 class="name" id="shouldRemount"><span class="type-signature"></span>shouldRemount<span class="signature">(unmountError<span class="signature-attributes">opt</span>, oldCarriage, mountError<span class="signature-attributes">opt</span>, newCarriage<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> <p>You can override it with useful functionality. Synchronously answers the question - is it necessary to remount this parent while remounting the child?</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line327">line 327</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>unmountError</code></td> <td class="type"> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>oldCarriage</code></td> <td class="type"> <span class="param-type"><code><a href="Carriage.html">Carriage</a></code></span> </td> <td class="attributes"> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>mountError</code></td> <td class="type"> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"> </td> </tr> <tr> <td class="name"><code>newCarriage</code></td> <td class="type"> <span class="param-type"><code><a href="Carriage.html">Carriage</a></code></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="tieChild"><span class="type-signature"></span>tieChild<span class="signature">(child)</span><span class="type-signature"></span></h4> <div class="description"> <p>Tie one child with this carriage parent.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line147">line 147</a> </li></ul></dd> </dl> <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>child</code></td> <td class="type"> <span class="param-type"><code><a href="Carriage.html">Carriage</a></code></span> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="unique"><span class="type-signature"></span>unique<span class="signature">(state<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> <p>Get unique state. If sended argument <code>state</code> returns boolean.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line130">line 130</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>state</code></td> <td class="type"> <span class="param-type"><code>Boolean</code></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"> <p>if sended, set this carriage as unique primary of this name.</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>Boolean</code></span> </dd> </dl> </div> </div> <div class="section-method"> <h4 class="name" id="unmount"><span class="type-signature"></span>unmount<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> <p>Sort unmount this carriage with childs. The carriages necessary for some other carriages will not be unmounted. Calls all functions from Carriage.unmountedCallbacks, if this carriage did unmount. Calls argument callback in any case, even if the unmount did not happen.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line263">line 263</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><code>Carriage~unmountCallback</code></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="unmountChilds"><span class="type-signature"></span>unmountChilds<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Cicle for sort unmount childs of this carriage. Not asynchronously and with callback, because there is no sense in waiting for the end of the unmounting childs. If you do not agree please describe the reason in the issues.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line296">line 296</a> </li></ul></dd> </dl> </div> <div class="section-method"> <h4 class="name" id="untieChild"><span class="type-signature"></span>untieChild<span class="signature">(child)</span><span class="type-signature"></span></h4> <div class="description"> <p>Untie one child with this carriage parent.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="carriage.js.html">carriage.js</a>, <a href="carriage.js.html#line156">line 156</a> </li></ul></dd> </dl> <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>child</code></td> <td class="type"> <span class="param-type"><code><a href="Carriage.html">Carriage</a></code></span> </td> <td class="description last"> </td> </tr> </tbody> </table> </div> </article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu May 11 2017 11:27:05 GMT+0000 (UTC) using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>